Uses
| Uses | Description |
|---|---|
| wp-includes/media.php: wp_get_attachment_image_url() | Get the URL of an image attachment. |
| wp-includes/post-thumbnail-template.php: get_post_thumbnail_id() | Retrieve post thumbnail ID. |
Return the post thumbnail URL.
(string|false) Post thumbnail URL or false if no URL is available.
File: wp-includes/post-thumbnail-template.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 );
} | Version | Description |
|---|---|
| 4.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_the_post_thumbnail_url