wp-includes/post-thumbnail-template.php:25Determines whether a post has an image attached.
$postint|WP_PostoptionalnullboolOne hook fires while has_post_thumbnail() runs, in this order:
Filters whether a post has a post thumbnail.
function has_post_thumbnail( $post = null ) { $thumbnail_id = get_post_thumbnail_id( $post ); $has_thumbnail = (bool) $thumbnail_id; /** * Filters whether a post has a post thumbnail. * * @since 5.1.0 * * @param bool $has_thumbnail true if the post has a post thumbnail, otherwise false. * @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`. * @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist. */ return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );}Introduced in 2.9.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$post retyped from int|WP_Post to int|WP_Post|null.verified against sourcesrc/wp-includes/post-thumbnail-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.