Change admin post thumbnail size for custom post type only

admin_post_thumbnail_size takes three parameters:

  1. $thumb_size: selected Thumb Size if you do nothing in the filter.

  2. $thumbnail_id: Thumbnail attachment ID.

  3. $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);

error code: 523