Filters the size used to display the post thumbnail image in the 'Featured Image' meta box.


apply_filters( 'admin_post_thumbnail_size', (string|array) $size, (int) $thumbnail_id, (WP_Post) $post ); 

Note: When a theme adds post-thumbnail support, a special post-thumbnail image size is registered, which differs from the thumbnail image size managed via the Settings > Media screen. See the $size parameter description for more information on default values.

Parameters (3)

0. $size (string|array)
Post thumbnail image size to display in the meta box. Accepts any valid image size, or an array of width and height values in pixels (in that order). If the post-thumbnail size is set, default is post-thumbnail . Otherwise, default is an array with 266 as both the height and width values.
1. $thumbnail_id (int)
Post thumbnail attachment ID.
2. $post (WP_Post)
The post object associated with the thumbnail.


To run the hook, copy the example below.
  1. $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post ); 
  3. if ( !empty( $size ) ) { 
  5. // everything has led up to this point... 
The following example is for adding a hook callback.
  1. // define the admin_post_thumbnail_size callback 
  2. function filter_admin_post_thumbnail_size( $size, $thumbnail_id, $post ) { 
  3. // make filter magic happen here... 
  4. return $size
  5. }; 
  7. // add the filter 
  8. add_filter( 'admin_post_thumbnail_size', 'filter_admin_post_thumbnail_size', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'admin_post_thumbnail_size', 'filter_admin_post_thumbnail_size', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

  1. $size = apply_filters( 'admin_post_thumbnail_size', $size, $thumbnail_id, $post );