Disable WordPress default Image Sizes

8 Jul 2022

I usually use images on my most of clients the maximum size of 1400px, and never used the medium_large image size for my clients except when the client forces to use. Then when I give the access to client, he may be sometime upload very large image which we don’t needed, so I use the below snippet to disable un-needed image sizes which wordpress generates for each uploaded file. Put this in any code-snippet plugin or functions.php file.

I use Scripts organizer with the below settings :

  1. Add a code block
  2. Set Trigger Location to Everywhere
  3. Put the code
  4. Publish and you are done.

Note: If you have already have some images uploaded, then these image sizes are not deleted automatically.

// Remove WP 'medium_large' SIZE
add_filter( 'intermediate_image_sizes', function( $sizes )
	return array_filter( $sizes, function( $val ) {
		return 'medium_large' !== $val;

// Remove 2x-medium-large and 2x-large SIZES
add_filter( 'intermediate_image_sizes', 'remove_default_img_sizes', 10, 1);
function remove_default_img_sizes( $sizes ) {
	$targets = ['1536x1536', '2048x2048'];
	foreach($sizes as $size_index=>$size) {
		if(in_array($size, $targets)) {
	return $sizes;

Was this article helpful?



Never miss new post again

Subscribe and get list of new posts in your inbox

Click to Copy