post_thumbnail_id filter
Filters the post thumbnail ID.
apply_filters( 'post_thumbnail_id', int|false $thumbnail_id, int|WP_Post|null $post )
Description
This is filter hook , its filter the post thumbnail ID.
Its consists of two parameters, ome is thumbnail ID or false , if post not exists and second is Post Id or WP_Post object.
It is used in get_post_thumbnail_id() which retrieves the thumbnail id.
Parameters
- $thumbnail_id : (int|false) Post thumbnail ID or false if the post does not exist.
- $post : (int|WP_Post|null) Post ID or WP_Post object. Default is global $post.
Live Example
To run the hook, copy the example below.
apply_filters( 'post_thumbnail_html', string $html, int $post_id, int $post_thumbnail_id, string|int[] $size, string|array $attr )