Skip to content

How To Get Featured Image URL In WordPress

Almost everyone is using featured images in its WordPress blog. I often need to get the post thumbnail URL in my projects, where is really simple. If you’re stuck in your projects and wondering how to get featured image URL in WordPress, you can use this code to get featured image URL within the loop.

Simply paste this code inside the loop code that you are writing:

$imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID) , 'full');
echo $imgsrc[0];

This snippet will get the featured image URL of the original image size. You can also use other featured image sizes as well. Hope this will help you.

Leave a Reply

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