apply_filters( 'post_thumbnail_id', int|false $thumbnail_id, int|WP_Post|null $post )
- Since
- 5.9.0
Filters the post thumbnail ID.
Compatibility
- WordPress
- since 5.9.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$thumbnail_idint|false- Post thumbnail ID or false if the post does not exist.
$postint|WP_Post|null- Post ID or WP_Post object. Default is global
$post.
Where this hook fires · 1
wp-includes/post-thumbnail-template.php:70get_post_thumbnail_id()
Source code
* * @since 5.9.0 * * @param int|false $thumbnail_id Post thumbnail ID or false if the post does not exist. * @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`. */ return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post );} /** * Displays the post thumbnail. * * When a theme adds 'post-thumbnail' support, a special 'post-thumbnail' image sizeChangelog
Introduced in 5.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.