A WordPress-centric search engine for devs and theme authors



has_post_thumbnail ›

Since2.9.0
Deprecatedn/a
has_post_thumbnail ( $post = null )
Parameters:
  • (int|WP_Post) $post Optional. Post ID or WP_Post object. Default is global `$post`.
    Required: No
    Default: null
Returns:
  • (bool) Whether the post has an image attached.
Defined at:
Codex:
Change Log:
  • 4.4.0

Check if post has an image attached.



Source

function has_post_thumbnail( $post = null ) {
	return (bool) get_post_thumbnail_id( $post );
}