[WordPress] Get Featured Image URL

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

1 Response

Since 4.4 we have new functions available:

get_the_post_thumbnail_url( $size );
the_post_thumbnail_url( $size )

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.