Function: get_the_post_thumbnail_url

get_the_post_thumbnail_url( integer | WP_Post $post, string | array $size )

Return the post thumbnail URL.


Name Type(s) Default Value Description
$post integer | WP_Post null

Optional. Post ID or WP_Post object. Default is global $post.

$size string | array 'post-thumbnail'

Optional. Registered image size to retrieve the source for or a flat array of height and width dimensions. Default 'post-thumbnail'.


string | false

Post thumbnail URL or false if no URL is available.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.