This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
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 )
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.