Ever wondered why WordPress creates so many different versions of the same image when you upload it? It’s because WordPress automatically generates multiple image sizes so your site runs smoothly; it can show thumbnails, blog images, or large header images. While this can be handy, you might end up with a lot of unnecessary images that just take up space.
If you're looking to save storage or keep your media library cleaner, don't worry – there’s a way to turn off these extra image sizes. You can either write some code or use a plugin.
Today, we will show you how to easily disable them, whether you prefer using a bit of code or a simple plugin. Let’s dive in!
Why WordPress Creates Multiple Image Sizes
When you upload an image to WordPress, it doesn't just store the original file. Instead, WordPress automatically creates several versions of that image in different sizes.
By default, WordPress generates three additional sizes: thumbnail, medium, and large, apart from the original size. These sizes are used in different parts of your website, like thumbnails for post listings, medium images for blog posts, or large images for headers.
The idea is to optimize how images are displayed based on where they're used. This is so your site loads quickly while maintaining good image quality.
Themes and plugins can also add their own custom image sizes. This is why you might find more than just the default ones. While this is helpful in many cases, it can also take up more storage space and clutter your media library with unnecessary image sizes you may never use. That’s why some users disable these extra image sizes to streamline their site.
How to Disable Registered Image Sizes
Method 1: Using Code in Functions.php
If you want to disable specific image sizes that are the default WordPress image size, you can do this easily. All you need do is add some code to your theme’s functions.php file. Follow these steps carefully:
Step 1: Access Your Theme’s functions.php File
First, locate and open the functions.php file in your WordPress theme. Search in the WordPress dashboard by going to:
Appearance > Theme Editor.
Next, find and click on the functions.php file under the Theme Files section.
Alternatively, if you're more comfortable using an FTP client or the file manager in your hosting control panel, you can access the file directly from your theme’s folder.
Step 2: Add Code to Disable Image Sizes
Now that you’ve opened the functions.php file, add some code that tells WordPress to stop generating specific image sizes. Here’s an example of how you can disable default image sizes like medium, large, and thumbnail:
<?php
function remove_default_image_sizes() {
remove_image_size('medium');
remove_image_size('large');
remove_image_size('thumbnail');
}
add_action('init', 'remove_default_image_sizes');
This code removes the selected image sizes when new images are uploaded. You can also add custom sizes registered by themes or plugins by adding their size names in the same way.
Step 3: Save the Changes
Once you’ve added the code, click the Update File button and save your changes. Be careful when editing your theme’s functions.php file. A slight mistake can cause errors on your site. It's always a good idea to make a backup before making any changes.
Step 4: Use a Child Theme (Optional)
When you're directly editing the functions.php file in your main theme updates may overwrite your changes. To avoid this, it's best to use a child theme so your modifications stay intact even after theme updates.
Method 2: Using a Plugin
Those who are not comfortable adding code to your site, a plugin can help to disable registered image sizes. This method is for those users who prefer a simpler, code-free solution. There are several plugins available including Media Library Tools , which is one of them. Using those plugins you can manage and disable the different image sizes WordPress defaults.
Once you install and activate a plugin, you can simply choose which image sizes you want to turn off. Check the settings menu. This makes it super easy to disable certain sizes without touching any files or adding code. The plugin do all the technical stuff for you in the background. Then you can avoid any mistakes.
Using a plugin is a convenient, beginner-friendly option for managing image sizes without having to deal with code or theme modifications.
When to Disable Registered Image Size
Here are some common situations when you should disable registered image size:
Limited Storage Space: If your hosting plan has limited storage, disabling extra image sizes can help save space by reducing the number of unnecessary images.
Using Custom Image Sizes: When your site only needs specific image dimensions, like custom sizes for product photos or blog posts, turning off default sizes can prevent clutter.
Improving Site Performance: Reducing the number of generated images can help your site run faster, especially during backups or when loading the media library.
Simplifying Media Management: Disabling unused image sizes keeps your media library cleaner and easier to manage, especially on sites with lots of images.
Theme or Plugin Changes: If you’ve switched themes or plugins that no longer use certain image sizes, you can safely disable them to avoid having extra files generated.
Conclusion
By disabling registered image sizes in WordPress you can save storage space and keeps your site’s media library organized. Whether you choose to edit the functions.php file or go with a plugin, both methods are simple and effective.
If you're comfortable with a bit of coding, tweaking the file gives you full control. On the other hand, using a plugin is a quick, no-code solution that anyone can handle.
Either way, by reducing unnecessary image sizes, you'll make your website more efficient and easier to manage!