Featured Image Url in WordPress comes with a pre-defined function , which allows to display the featured image in our site.
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;
$thumb_url provides you the url of the featured image.