WordPress at a glance

get_the_post_thumbnail_url() WP 1.0

Return the post thumbnail URL.

Is the basis for: the_post_thumbnail_url()
✈ 1 time = 0.001901s = very slow | 50000 times = 18s = slow | PHP 7.0.5, WP 4.4.2

No Hooks.


String/false. Post thumbnail URL or false if no URL is available.


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-includes/post-thumbnail-template.php WP 5.4.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 );

Related Functions

From tag: Thumbnail (images)

More from category: Thumbnails

No comments
        Log In . Register