How to Unset WordPress Image Sizes Without Breaking Your Theme

Managing a WordPress website often feels like tending a garden. You plant content, nurture it, and hope it flourishes. But sometimes, unwanted weeds—like excessive image sizes—can overrun your digital plot. WordPress, in its effort to be helpful, automatically generates multiple versions of every image you upload. While this can be beneficial, it can also lead to bloated storage and a cluttered media library. Let’s explore how to prune these unnecessary image sizes without accidentally uprooting your site’s design.

Understanding WordPress Image Sizes

When you upload an image to WordPress, it doesn’t just store the original. Instead, it creates several copies in different dimensions to accommodate various design needs:

  • Thumbnail: Typically 150×150 pixels, used for post thumbnails or featured images.
  • Medium: Around 300×300 pixels, suitable for in-content images.
  • Large: Approximately 1024×1024 pixels, often used for full-width images.
  • Medium Large: Introduced in newer versions, with a width of 768 pixels.
  • Additional Sizes: Depending on your theme or plugins, there might be even more, like 1536×1536 or 2048×2048 pixels.

While this system ensures images fit different parts of your site, it can also lead to a surplus of files. Imagine uploading 100 images and ending up with 500 files due to these automatic resizes. That’s like ordering a dozen donuts and receiving 60—tempting, but unnecessary.

Why Unset Unnecessary Image Sizes?

Beyond the obvious storage concerns, having numerous unused image sizes can:

  • Slow Down Backups: More files mean longer backup times.
  • Complicate Media Management: Navigating through multiple versions of the same image can be confusing.
  • Increase Hosting Costs: Especially if your hosting plan charges based on storage usage.

By unsetting unnecessary image sizes, you streamline your site’s operations and keep your media library tidy.

Assessing Your Theme’s Image Size Usage

Before wielding the pruning shears, it’s crucial to identify which image sizes your theme and plugins actively use. Removing an image size that’s in use is akin to removing a chair leg—things might topple over.

How to Identify Active Image Sizes:

  1. Inspect Theme Files: Delve into your theme’s files, especially those that handle image displays, to see which sizes are called.
  2. Use Plugins: Tools like ‘Simple Image Sizes’ can list all registered image sizes and where they’re used.
  3. Consult Documentation: Theme and plugin documentation often specify which image sizes they utilize.

Methods to Unset Unnecessary Image Sizes

Once you’ve identified the image sizes that are surplus to requirements, you can proceed to disable them. Here are a few methods:

1. Adjusting Media Settings via the Dashboard

The simplest approach involves tweaking settings within the WordPress admin area:

  1. Navigate to Settings > Media.
  2. Set the width and height of the sizes you wish to disable to 0.
  3. Save changes.

This method prevents WordPress from generating these sizes for future uploads. However, it does not affect sizes added by themes or plugins.

It also does not cover everything core generates. Settings > Media only exposes Thumbnail, Medium and Large. The 768px medium_large size and the 1536px and 2048px sizes have no fields on that screen at all, so the dashboard alone cannot switch them off. For those you need code or a plugin.

2. Programmatically Unsetting Image Sizes

For those comfortable with a bit of coding, you can add functions to your theme’s functions.php file:

Using the intermediate_image_sizes_advanced Filter:

functions.php

function remove_default_image_sizes($sizes) {


    unset($sizes['thumbnail']);    // 150px


    unset($sizes['medium']);       // 300px


    unset($sizes['large']);        // 1024px


    unset($sizes['medium_large']); // 768px


    unset($sizes['1536x1536']);    // 1536px


    unset($sizes['2048x2048']);    // 2048px


    return $sizes;


}


add_filter('intermediate_image_sizes_advanced', 'remove_default_image_sizes');


Do not paste that snippet as-is. It removes every default size, including ones WordPress genuinely needs, and it is the fastest way to break a working site.

thumbnail is used throughout the admin, in the media library grid, in the block editor’s image picker and by many plugins. medium and large are what WordPress puts into the responsive srcset attribute on your content images.

A safer starting point removes only the sizes most themes never call:

function txp_remove_unused_image_sizes( $sizes ) {
    unset( $sizes['1536x1536'] ); // added by WordPress 5.3
    unset( $sizes['2048x2048'] ); // added by WordPress 5.3
    return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'txp_remove_unused_image_sizes' );

Those two are generated on every upload and most themes never reference them, so they are the safest saving available. Add medium_large to the list only after checking that your theme does not use 768px in its srcset.

Remember, editing functions.php directly can be risky. Always back up your site first, and put the snippet in a child theme or a code-snippets plugin rather than the parent theme.

Using the remove_image_size() Function:

If your theme or plugins have registered custom sizes, you can remove them like so:

functions.php

function remove_custom_image_sizes() {


    remove_image_size('custom-size-name');


    // Repeat for other custom sizes as needed


}


add_action('init', 'remove_custom_image_sizes');


Replace 'custom-size-name' with the actual name of the image size you wish to remove.

Timing matters here. Themes register their sizes on after_setup_theme and plugins often register theirs on init, so hooking your removal to init at the default priority can run before the size you are trying to remove even exists.

If a size refuses to disappear, run the removal later:

add_action( 'init', 'remove_custom_image_sizes', 99 );

3. Utilizing Plugins to Manage Image Sizes

If coding isn’t your cup of tea, several plugins can help manage image sizes:

  • Disable Media Sizes: Allows you to disable specific image sizes through a user-friendly interface.
  • Image Sizes Controller: Provides control over creating and disabling image sizes.

Always ensure plugins are compatible with your WordPress version and keep them updated.

The Bigger Disk Hog Nobody Mentions: -scaled Images

Before you spend an afternoon shaving off thumbnail sizes, check this, because on most sites it is worth more than all the others put together.

Since WordPress 5.3, any image you upload wider or taller than 2560 pixels gets automatically scaled down. WordPress then serves the scaled copy and gives it a -scaled suffix, so beach.jpg becomes beach-scaled.jpg.

Here is the part that costs you space: the full-size original stays on disk too. You now have the untouched original, the scaled version, and every registered thumbnail size, all from one upload.

Modern phone cameras produce images well over 2560px, so if anyone on your team uploads straight from a phone, this is happening on nearly every upload. A single 6MB original with a scaled copy dwarfs the handful of kilobytes you save by dropping a 150px thumbnail.

Changing or Disabling the Threshold

The threshold is controlled by the big_image_size_threshold filter. To lower it so the stored copy is smaller:

add_filter( 'big_image_size_threshold', function() { return 1600; } );

To switch the behaviour off entirely, return false:

add_filter( 'big_image_size_threshold', '__return_false' );

Think before you disable it. With scaling off, WordPress serves the full original, so a 6000px photo goes to a phone at full size. For most sites lowering the threshold is the right move and turning it off is not.

The Fix That Beats All of This

Resize images before uploading them. A 1600px-wide JPEG at reasonable quality covers almost every use on a normal site.

No filter, no plugin and no regeneration run saves as much as simply not uploading a 6000px file in the first place.

Regenerating Thumbnails After Unsetting Sizes

After disabling certain image sizes, your media library will still contain previously generated images. To clean up:

  1. Install and activate the ‘Regenerate Thumbnails’ plugin. It has over a million installs and is still maintained, but its listing currently shows it tested only up to WordPress 6.8, so you may see a compatibility notice. Back up first, as you should before any bulk media operation.
  2. Navigate to Tools > Regen. Thumbnails
  3. Click ‘Regenerate Thumbnails’ to process all images.

This ensures only the necessary image sizes remain, freeing up server space.

The Trade-off: Responsive Images and srcset

This is the part that turns a tidy-up into a performance problem, and most guides on this topic leave it out.

WordPress does not just store extra sizes for the media library. It uses them to build the srcset attribute on your images, the list that lets a browser pick the smallest file that still looks sharp on that screen.

Remove those sizes and the list gets shorter. Remove enough of them and a phone has nothing to choose but the biggest remaining file.

What That Costs You

A phone that should have downloaded a 300px image downloads a 1024px one instead. It is slower on mobile data, and it hurts Largest Contentful Paint, which is a ranking signal.

So you saved a few megabytes of disk, which nobody sees, and made every mobile page view heavier, which everybody feels. That is a bad trade.

How to Check Before You Remove Anything

Open a post on the live site, right-click a content image and choose Inspect. Look at the srcset attribute on the <img> tag.

Every width listed there is a size in active use. Do not unset any of them. Whatever is registered but never appears in a srcset anywhere on your site is the safe list.

A Sensible Rule of Thumb

Keep thumbnail, medium and large. Remove 1536×1536 and 2048×2048 unless you can see them in a srcset. Treat medium_large as a maybe, since some themes use it and some never touch it.

Then set the big image threshold sensibly and get your team uploading smaller files. That combination saves real space without costing you a single kilobyte of visitor performance.

Best Practices and Considerations

  • Backup Your Site: Before making changes, always have a recent backup. It’s better to be safe than sorry.
  • Use a Child Theme: When editing theme files, use a child theme to prevent your changes from being overwritten during updates.
  • Test Thoroughly: After unsetting image sizes, review your site to ensure images display correctly across all devices.
  • Monitor Disk Usage: Regularly check your hosting storage to ensure you’re not nearing any limits.

Conclusion

Managing image sizes in WordPress is a balancing act. While the platform’s automatic resizing serves a purpose, it can sometimes be overzealous. By understanding which sizes are necessary and taking steps to disable the rest, you can keep your site lean, mean, and running smoothly. Remember, it’s not about having fewer images—it’s about having the right ones.


FAQ

Q: Will unsetting image sizes affect existing images on my site?

A: Unsetting image sizes prevents WordPress from generating those sizes for future uploads. Existing images remain unaffected but can be cleaned up using plugins like ‘Regenerate Thumbnails.’

Q: What is a -scaled image in WordPress?

A: Since WordPress 5.3, any upload larger than 2560 pixels on its longest side is automatically scaled down to that limit and saved with a -scaled suffix, which is the version WordPress serves. The full-size original is kept on disk as well, so one large upload leaves you with the original, the scaled copy and every registered thumbnail. You can change the limit with the big_image_size_threshold filter.

Q: Which image sizes are safe to remove?

A: Check the srcset attribute on a content image on your live site. Every width listed there is in active use and should be kept, which normally means thumbnail, medium and large. The 1536×1536 and 2048×2048 sizes added in WordPress 5.3 are the usual safe removals, since most themes never reference them.

Q: Can I re-enable an image size after unsetting it?

A: Absolutely. Simply reverse the steps you took to unset the size. If you used code, remove or comment out the relevant lines. If you adjusted settings in the dashboard, reset the dimensions to their original values.

Q: Are there any risks to unsetting image sizes?

A: The primary risk is removing a size that’s actively used by your theme or plugins, which can lead to display issues. Always identify active sizes before making changes and test your site thoroughly afterward.

Q: Do I need to unset image sizes if I have ample server storage?

A: While ample storage reduces the urgency, unsetting unused image sizes can still benefit site organization and backup efficiency. It’s about cleanliness and efficiency, not just space.

Q: Will unsetting image sizes improve my site’s performance?

A: Indirectly, and it can go the other way. Fewer generated files mean a lighter media library and quicker backups, but it does not directly speed up page loads for visitors. If you remove the sizes your theme uses in its srcset, phones end up downloading a far larger image than they need and your pages get slower, not faster.

Sandeep
Sandeep
Sandeep has worked in search engine optimisation for ten years, across technical SEO, content strategy, local search and the tools the job actually runs on. He writes and edits everything on Techno Xprt. His approach here is deliberately unglamorous: check the vendor's own pricing page rather than a roundup, confirm a feature still exists before recommending it, and go back and correct a post when the facts move. A large part of the work on this site has been exactly that, finding advice that quietly went out of date and fixing it. He writes for people doing the work themselves, small business owners and in-house marketers, rather than for other SEOs.
Recent Articles

Related Stories