Tag Archives: featured image

How to get the featured image url from a WordPress post

How to get the featured image url from a WordPress post

This is going to be a very quick recipy.

Two lines I always use in order to obtain the url for the featured image, full size. This could be useful if you want full control of the code, like placing the image as a background for a box, instead of relying on the img tag that the_post_thumbnail() outputs.

Here you are:

<?php
     // GET IMAGE LINK
     $thumbfull = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );
     urlfull = $thumbfull['0']; 
?>

Now you can use $urlfull wherever you wish.