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.

Return

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

Usage

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

Code of get_the_post_thumbnail_url: wp-includes/post-thumbnail-template.php VER 5.0.1

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

Related Functions

From tag: Thumbnail (images)

More from category: Thumbnails

No comments
    Hello, !     Log In . Register