WPDev.one
Core Function
View Source on Trac ↗

get_the_post_thumbnail_url()

get_the_post_thumbnail_url( mixed $post = null, mixed $size = 'post-thumbnail' )

Returns the post thumbnail URL.

Parameters 2 required

Name / Type Description
(int

| WP_Post | null) $post Optional. Post ID or WP_Post object. Default is global `$post`.

Required
mixed

(string | int[]) $size Optional. Registered image size to retrieve the source for or a flat array of height and width dimensions. Default 'post-thumbnail'.

Required

Return Value

((string)
(string | false) Post thumbnail URL or false if no image is available. If `$size` does not match any registered image size, the original image URL will be returned.

Function Information

Since Version
4.4.0
Source File
wp-includes/post-thumbnail-template.php
Advertisement