the_post_thumbnail_url
Display the post thumbnail URL.
Description
the_post_thumbnail_url( (string) $size = 'post-thumbnail' );
Parameters (1)
- 0. $size — Optional. (string) =>
'post-thumbnail'
- 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..
Usage
if ( !function_exists( 'the_post_thumbnail_url' ) ) { require_once ABSPATH . WPINC . '/post-thumbnail-template.php'; } $size = 'post-thumbnail'; // NOTICE! Understand what this does before running. $result = the_post_thumbnail_url($size);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/post-thumbnail-template.php
- function the_post_thumbnail_url( $size = 'post-thumbnail' ) {
- $url = get_the_post_thumbnail_url( null, $size );
- if ( $url ) {
- echo esc_url( $url );
- }
- }