How to get featured image url of a post or pages

In this post, we are going to learn about WordPress get featured image URL now start step by step

First, get the id of the post or page of which featured image URL you want to get by using the code $post->ID

Second get the id of the thumbnail image bypassing the post id through the function get_post_thumbnail_id($post->ID)

Third-get the attachment URL and print that bypassing the thumb id through the function wp_get_attachment_url( get_post_thumbnail_id($post->ID))

Now here is the full code:

ID;
$post_thumb_id = get_post_thumbnail_id($post_id);
$attachment_img_url = wp_get_attachment_url( $post_thumb_id );
?>
”<?php” />

Thanks for Reading

Share The Post On -

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.