Function: get_post_thumbnail_id

get_post_thumbnail_id( integer | WP_Post $post )

Retrieve post thumbnail ID.


Name Type(s) Default Value Description
$post integer | WP_Post null

Optional. Post ID or WP_Post object. Default is global $post.


string | integer

Post thumbnail ID or empty string.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.