get_the_post_thumbnail_url( int|WP_Post $post = null, string|array $size = 'post-thumbnail' )
Return the post thumbnail URL.
Parameters
Return
(string|false) Post thumbnail URL or false if no URL is available.
Source
File: wp-includes/post-thumbnail-template.php
function get_the_post_thumbnail_url( $post = null, $size = 'post-thumbnail' ) {
$post_thumbnail_id = get_post_thumbnail_id( $post );
if ( ! $post_thumbnail_id ) {
return false;
}
return wp_get_attachment_image_url( $post_thumbnail_id, $size );
}
Changelog
Version | Description |
---|---|
WP-4.4.0 | Introduced. |