Featured Image Url in WordPress comes with a pre-defined function , which allows to display the featured image in our site.

the_post_thumbnail();

The problem is, it doesn’t provide any function to grab the url of the featured image. For that I have created a code snippet which allows you to grab the url of the featured image.

Copy the code and paste it inside the loop :

$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'full', true);
$thumb_url = $thumb_url_array[0];

$thumb_url provides you the url of the featured image.

Leave a Reply

Or

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image

Find us on Facebook

Subscribe to our Newsletter