Summery Summery
Retrieve post thumbnail ID.
Syntax Syntax
Parameters Parameters
- $post
-
(Optional) Post ID or WP_Post object. Default is global
$post.Default value: null
Return Return
(int|string) Post thumbnail ID or empty string if the post does not exist.
Source Source
File: wp-includes/post-thumbnail-template.php
* @return int|false Post thumbnail ID (which can be 0 if the thumbnail is not set),
* or false if the post does not exist.
*/
function get_post_thumbnail_id( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
Advertisement
Changelog Changelog
| Version | Description |
|---|---|
| 4.4.0 | $post can be a post ID or WP_Post object. |
| 2.9.0 | Introduced. |