post_thumbnail_id filter-hookWP 5.9.0

Filters the post thumbnail ID.

Usage

add_filter( 'post_thumbnail_id', 'wp_kama_post_thumbnail_id_filter', 10, 2 );

/**
 * Function for `post_thumbnail_id` filter-hook.
 * 
 * @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.
 *
 * @return int|false
 */
function wp_kama_post_thumbnail_id_filter( $thumbnail_id, $post ){

	// filter...
	return $thumbnail_id;
}
$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: global $post

Changelog

Since 5.9.0 Introduced.

Where the hook is called

get_post_thumbnail_id()
post_thumbnail_id
wp-includes/post-thumbnail-template.php 70
return (int) apply_filters( 'post_thumbnail_id', $thumbnail_id, $post );

Where the hook is used in WordPress

Usage not found.