has_post_thumbnail


has_post_thumbnail ( $post = null )

Parameters:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global `$post`.
Returns:
  • (bool) Whether the post has an image attached.
Defined at:
Change Log:
  • 4: .

Description

Determines whether a post has an image attached.

For more information on this and similar theme functions, check out the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ Conditional Tags} article in the Theme Developer Handbook.

Related Functions

the_post_thumbnail, set_post_thumbnail, the_post_thumbnail_url, get_the_post_thumbnail, set_post_thumbnail_size

Top Google Results

User discussions

wpseek mobile