the_post_thumbnail_url()
Display the post thumbnail URL.
1 time — 0.002188 sec (very slow) | 50000 times — 17.96 sec (slow) | PHP 7.0.5, WP 4.4.2
No Hooks.
Return
null
. Nothing.
Usage
the_post_thumbnail_url( $size );
- $size(string|int[])
- Image size to use. Accepts any valid image size, or an array of width and height values in pixels (in that order).
Default: 'post-thumbnail'
Changelog
Since 4.4.0 | Introduced. |
Code of the_post_thumbnail_url() the post thumbnail url WP 6.0
function the_post_thumbnail_url( $size = 'post-thumbnail' ) { $url = get_the_post_thumbnail_url( null, $size ); if ( $url ) { echo esc_url( $url ); } }