fbpx
How to Get WordPress Featured Image Source (img src)

How to Get WordPress Featured Image Source (img src)

With the WordPress function: wp_get_attachment_image_src, you can get the img src of the featured image.

Instructions
Add this code to your page/post template file where you want to use the featured image source.

<?php
 $imgsrc = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "Full");
 echo $imgsrc[0];
?>