Displays the post thumbnail URL.
$sizestring|int[]optional
'post-thumbnail'.Default:'post-thumbnail'
function the_post_thumbnail_url( $size = 'post-thumbnail' ) {
$url = get_the_post_thumbnail_url( null, $size );
if ( $url ) {
echo esc_url( $url );
}
}
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/the_post_thumbnail_url