has_post_thumbnail filter-hook . WP 5.1.0
Filters whether a post has a post thumbnail.
Usage
add_filter( 'has_post_thumbnail', 'filter_function_name_9147', 10, 3 ); function filter_function_name_9147( $has_thumbnail, $post, $thumbnail_id ){ // filter... return $has_thumbnail; }
- $has_thumbnail(true/false)
- true if the post has a post thumbnail, otherwise false.
- $post(int|WP_Post|null)
- Post ID or WP_Post object.
Default: global $post - $thumbnail_id(int|false)
- Post thumbnail ID or false if the post does not exist.
Changelog
Since 5.1.0 | Introduced. |
Where the hook is called
has_post_thumbnail
wp-includes/post-thumbnail-template.php 38
return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );