How to stop WordPress generating 20 image sizes per upload

•

I once opened a client’s uploads folder and found that a single photo had spawned sixteen separate files on disk. Nobody had done anything unusual to cause it. That’s simply what happens when a theme, a page builder, and WooCommerce all register their own image sizes, and nobody ever adds up the total.

Why one upload becomes many files

WordPress ships with a handful of built-in sizes it generates automatically for every image you upload:

  • thumbnail — 150×150 by default, hard-cropped to that exact shape.
  • medium — up to 300×300, scaled to fit rather than cropped.
  • medium_large — 768px wide, added in WordPress 4.4 for responsive layouts.
  • large — up to 1024×1024, scaled to fit.
  • 1536x1536 and 2048x2048 — added in WordPress 5.3 to support srcset, the mechanism browsers use to pick the right image size for a visitor’s screen. I’ve written separately about how srcset decides which size actually gets served, which is worth reading if you’ve ever noticed a blurry or oversized image loading on the frontend.

On top of those built-in sizes, your theme and any active plugins can register their own custom sizes using a function called add_image_size(). A WooCommerce product image size, a page builder’s grid thumbnail, a slider plugin’s specific crop, a theme’s featured-image variant — every one of these gets generated as a separate physical file, every single time you upload an image. That happens whether or not that size ever actually gets used anywhere on the site.

Seeing what’s actually registered

Before trimming anything, check what’s actually registered on your site first — guessing wastes time. Drop this code somewhere temporary, like a must-use plugin file or functions.php while you’re debugging, and check what it prints:

add_action( 'wp_footer', function() {
    if ( current_user_can( 'manage_options' ) ) {
        echo '<pre>';
        print_r( get_intermediate_image_sizes() );
        global $_wp_additional_image_sizes;
        print_r( $_wp_additional_image_sizes );
        echo '</pre>';
    }
});

get_intermediate_image_sizes() gives you the full list of registered size names, both core and custom. $_wp_additional_image_sizes gives you the width, height, and crop details for the custom ones specifically, so you can see exactly what each plugin or theme added and decide what’s actually worth keeping.

Trimming it down

Disabling the core sizes you don’t need

For thumbnail, medium, and large, the simplest method needs no code at all. Go to Settings → Media and set a size’s width and height fields to 0. WordPress will stop generating that size on new uploads.

The remaining sizes don’t have a Settings screen field, so for medium_large, 1536x1536, and 2048x2048, you’ll need a small snippet using remove_image_size() instead:

add_action( 'init', function() {
    remove_image_size( 'medium_large' );
    remove_image_size( '1536x1536' );
    remove_image_size( '2048x2048' );
});

Removing a custom size a plugin or theme registered

remove_image_size() works exactly the same way for custom sizes, as long as you call it after the size was registered in the first place. Hooking into init at a normal priority is usually late enough. If a theme registers its sizes on after_setup_theme at a very late priority, though, you may need to bump your own priority number higher so your code runs after it.

Filtering the whole list at once

If you’d rather work from a blocklist than remove sizes one function call at a time, the intermediate_image_sizes filter lets you filter the array directly. This affects generation for both core and plugin-registered sizes in one place:

add_filter( 'intermediate_image_sizes', function( $sizes ) {
    return array_diff( $sizes, array( 'medium_large', '1536x1536', '2048x2048' ) );
});

Disabling the auto-scaled “-scaled” copy

Separate from all the registered sizes above, WordPress also creates one more scaled-down copy, suffixed -scaled, of any uploaded image wider than 2560px by default. This keeps the original from being served at full, unnecessary size. If you’re intentionally uploading pre-optimized images already and don’t want this extra copy, you can turn it off:

add_filter( 'big_image_size_threshold', '__return_false' );

Don’t confuse this with image_size_names_choose

One filter people often reach for by mistake is image_size_names_choose. It only changes which size names appear in the “Image Size” dropdown when you’re inserting an image in the editor. It doesn’t stop the file from being generated in the first place — it just hides that option from the picker:

add_filter( 'image_size_names_choose', function( $sizes ) {
    unset( $sizes['medium_large'] );
    return $sizes;
});

Use this alongside remove_image_size() if you want a size gone from disk and gone from the editor’s dropdown. Using it by itself saves you nothing in disk space — it’s purely cosmetic.

What about images you already uploaded?

None of the changes above are retroactive. They only affect new uploads going forward. Existing media still has every size file that was generated under the old rules, sitting on disk taking up space. A bloated media library like that can also be part of why your wp-admin feels sluggish overall, which ties into the broader troubleshooting approach I cover in debugging a slow WordPress dashboard.

If you need existing images regenerated to match your new, trimmed-down size list, a plugin like Regenerate Thumbnails, or WP-CLI’s wp media regenerate, will recreate the sizes that are still registered. Neither one automatically deletes the orphaned files for sizes you’ve since removed, though — for actual disk cleanup of those leftover files, you’ll want a dedicated media-cleanup tool. I’d recommend testing on a staging copy of your site first, since bulk-deleting files from your uploads folder is a one-way operation you don’t want to get wrong on the live version.

Frequently Asked Questions About WordPress Image Sizes

Why does WordPress generate so many image sizes in the first place?

It’s trying to have the right size ready for every context your image might appear in — a thumbnail in a grid, a medium size in a blog post, a large version for a full-width display, and higher-resolution versions for sharp screens. The problem isn’t that this exists; it’s that themes and plugins keep adding more sizes on top without anyone checking whether they’re all still needed.

Do I need a developer to trim my image sizes down?

The Settings → Media changes need no code at all, so you can do those yourself. Removing the sizes without a Settings field, like medium_large or a custom plugin size, does require adding a short snippet to your site, which is a reasonable thing to hand to a developer if you’re not comfortable editing code directly.

Will removing image sizes break my site’s design?

It can, if a theme or plugin is actively depending on a size you remove to display images somewhere specific. That’s why checking what’s actually registered first, before removing anything, matters — and why it’s worth reviewing key pages after making a change to confirm images still display correctly.

Will this actually free up disk space on my existing site?

Not by itself. Everything above only stops new size files from being generated going forward; it doesn’t touch the ones already sitting in your uploads folder from before. Freeing up existing space requires a separate cleanup step, ideally tested on a staging copy first.

How many image sizes should a typical site actually keep?

There’s no single right number, but a good exercise is checking what’s registered against what’s actually used in your theme’s templates and page builder settings. It’s common to find two or three sizes nobody uses at all once you actually look.

Is this worth doing on a small site, or only large ones?

It matters more as your media library grows, but even a small site benefits from not generating unused files on every upload. If you’re only uploading a handful of images a month, it’s a low priority; if you’re uploading dozens of product photos a week, trimming unused sizes adds up fast.

None of this requires ripping anything out blindly. Check what’s registered, decide what’s actually earning its place, and remove the rest — your uploads folder, and your backups, will thank you.

One response to “How to stop WordPress generating 20 image sizes per upload”

Leave a Reply

Your email address will not be published. Required fields are marked *