admin_post_thumbnail_size
takes three parameters:
-
$thumb_size: selected Thumb Size if you do nothing in the filter.
-
$thumbnail_id: Thumbnail attachment ID.
-
$post: associated WP_Post instance
So you may make use of these parameters to have a better control in your CODE. Use the CODE like below:
function custom_admin_thumb_size( $thumb_size, $thumbnail_id, $post ) {
if( 'slider' === $post->post_type ) {
return array( 1000, 400 );
}
return $thumb_size;
}
add_filter( 'admin_post_thumbnail_size', 'custom_admin_thumb_size', 10, 3);