get_post_thumbnail_id( int|WP_Post $post = null )
Retrieve post thumbnail ID.
Description Description
Parameters Parameters
Return Return
(string|int) Post thumbnail ID or empty string.
Source Source
File: wp-includes/post-thumbnail-template.php
function get_post_thumbnail_id( $post = null ) { $post = get_post( $post ); if ( ! $post ) { return ''; } return get_post_meta( $post->ID, '_thumbnail_id', true ); }
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
4.4.0 | $post can be a post ID or WP_Post object. |
2.9.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Show all attachments for the current post except the Featured Image
To get all post attachments except the Featured Image, you can use this function with something like
get_posts()
.Do this inside The_Loop (where
$post->ID
is available).
Expand full source codeCollapse full source code