WordPress at a glance

get_the_post_thumbnail_url() WP 1.0

Return the post thumbnail URL.

1 time — 0.001901 sec (very slow) | 50000 times — 18 sec (slow) | PHP 7.0.5, WP 4.4.2

No Hooks.


String|false. Post thumbnail URL or false if no image is available. If $size does not match any registered image size, the original image URL will be returned.


get_the_post_thumbnail_url( $post, $size );
Post ID or WP_Post object.
Default: global $post
Registered image size to retrieve the source for or a flat array of height and width dimensions.
Default: 'post-thumbnail'


Since 4.4.0 Introduced.

Code of get_the_post_thumbnail_url() WP 5.7.2

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 );

From tag: Thumbnail (images)

More from category: Thumbnails

No comments
    Log In