Prevent WordPress from generating medium_large 768px size of image uploads?

To remove the medium_large image size you can try to remove it with the intermediate_image_sizes filter:

add_filter( 'intermediate_image_sizes', function( $sizes )
{
    return array_filter( $sizes, function( $val )
    {
        return 'medium_large' !== $val; // Filter out 'medium_large'
    } );
} );

Not sure if you’re trying to remove all the intermediate sizes, but then you could try out:

add_filter( 'intermediate_image_sizes', '__return_empty_array', 999 );

where __return_empty_array()` is a built-in core function.

We should note that it’s not possible to remove it with

remove_image_size( 'medium_large' );

because it’s not added with add_image_size() and therefore not part of the $_wp_additional_image_sizes global array or wp_get_additional_image_sizes();

Leave a Comment