post_thumbnail_size
Filters the post thumbnail size.
Usage
add_filter( 'post_thumbnail_size', 'wp_kama_post_thumbnail_size_filter', 10, 2 );
/**
* Function for `post_thumbnail_size` filter-hook.
*
* @param string|int[] $size Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
* @param int $post_id The post ID.
*
* @return string|int[]
*/
function wp_kama_post_thumbnail_size_filter( $size, $post_id ){
// filter...
return $size;
}
- $size(string|int[])
- Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
- $post_id(int)
- The post ID.
Changelog
| Since 2.9.0 | Introduced. |
| Since 4.9.0 | Added the $post_id parameter. |
Where the hook is called
wp-includes/post-thumbnail-template.php 184
$size = apply_filters( 'post_thumbnail_size', $size, $post->ID );