has_post_thumbnail WordPress Filter Hook

The has_post_thumbnail hook is used to check if a post has a thumbnail. If a post has a thumbnail, the hook returns true. If a post does not have a thumbnail, the hook returns false.

apply_filters( 'has_post_thumbnail', bool $has_thumbnail, int|WP_Post|null $post, int|false $thumbnail_id ) #

Filters whether a post has a post thumbnail.


Parameters

$has_thumbnail

(bool)true if the post has a post thumbnail, otherwise false.

$post

(int|WP_Post|null)Post ID or WP_Post object. Default is global $post.

$thumbnail_id

(int|false)Post thumbnail ID or false if the post does not exist.


Top ↑

Source

File: wp-includes/post-thumbnail-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.