Title: has_post_thumbnail
Published: February 22, 2019
Last modified: May 20, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#wp--skip-link--target)

Filters whether a post has a post thumbnail.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#parameters)󠁿

 `$has_thumbnail`bool

true if the post has a post thumbnail, otherwise false.

`$post`int|[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
|null

Post ID or [WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
object. Default is global `$post`.

`$thumbnail_id`int|false

Post thumbnail ID or false if the post does not exist.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#source)󠁿

    ```php
    return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post-thumbnail-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/post-thumbnail-template.php#L38)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/post-thumbnail-template.php#L38-L38)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#related)󠁿

| Used by | Description | 
| [has_post_thumbnail()](https://developer.wordpress.org/reference/functions/has_post_thumbnail/)`wp-includes/post-thumbnail-template.php` |

Determines whether a post has an image attached.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/has_post_thumbnail/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.1.0](https://developer.wordpress.org/reference/since/5.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fhas_post_thumbnail%2F)
before being able to contribute a note or feedback.