How to Prevent WordPress Generating 3 Different Image Sizes

Share on facebook
Share on twitter
Share on email

Learn how to prevent WordPress generating 3 different image sizes and why it matters. WP auto-creates a thumbnail, medium-sized, and large image for every graphics file you upload. Moreover, themes and plugins may also add copies, pushing this number up even higher. Auto image generation needs more storage capacity and increases backup file sizes.

None of this concerns smaller blogs and websites that use images sparingly. But so many duplicated graphic files for larger, image-rich projects is not so good.

The Problem with WordPress Generated Images

There are two main problems when WordPress generates additional image sizes with larger websites. One is the unnecessary waste of space, and the other is potentially time-consuming backups. It makes no sense to have so many image sizes if you have zero use for them.

#1 Redundant images waste valuable space

Each time you upload an image, WordPress saves it to your Media Library as a media file. But it also makes copies of the same image whether you want them or not. Many websites only use the uploaded image once, which means one file of one size. Any other auto-generated images can become redundant and a waste of valuable disk space.

#2 Images can slow down backups

Times a thousand images by three, and even more if your plugins and WordPress theme creates copies. All these extra images result in larger backups. That means backup software needs more time to prepare and additional space to store your graphic files. Large backups can also consume a lot of server resources, which may cause issues on budget-priced web hosting accounts.

Add Your Heading Text Here

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Image Audit in cPanel

This guide is not for WordPress owners who run tiny websites. It’s aimed more at larger projects that want to reduce the number of unnecessary stored images. The amount of saved graphics—and the space they take up—often surprises site owners.

Let’s begin this guide with a quick image upload and file audit to illustrate.

Log in to your WP Admin Area

You can drag-n-drop an image into the upload area or select one from another device.

Let’s choose ‘Select Files’ and upload a single image file called kitten.

There’s a confirmation message with an edit link after the successful upload.

Now let’s see the new image on the server and all the auto-generated copies.

How to access your web server

You need an FTP client or access to your cPanel (Control Panel) File Manager to test your site. This guide is using cPanel to illustrate as all users will have one. Please read ‘What Is cPanel | A Guide for Beginners’ first if you’re unfamiliar with its interface.

Log in to your WordPress cPanel account.

From the FILES section, click File Manager. The program opens in a new tab.

You’re now at the File Manager main screen.

Click the public_html folder in the File Directory Tree on the left of the screen.

This action opens your WordPress files and folders on the right of the screen.

Open wp-content/uploads to reveal its folders.

WordPress saves your uploaded image files in year folders named by numbers, i.e., 2020.

The year folder holds month subfolders, also named by numbers, i.e., 01 = January.

Click the year folder and the current month’s folder to open it, e.g., 2021/02.

Our directory path looks like this: public_html/wp-content/uploads/2021/02

The single kitten image we uploaded from the WP Dashboard has become eight files.

This happens with every graphics file you upload. Three of those are the WordPress defaults for thumbnail, medium, and large-sized images. Others are theme and or plugin-generated.

A Word of Caution

Understand the consequences before you prevent WordPress from generating extra image files.

WordPress uses thumbnail images for galleries. Don’t change the thumbnail values in the steps below if you use—or intend to use—gallery displays on your website or blog.

WordPress themes may use post thumbnails—also called featured images—sliders, images for custom posts, and more. Only remove them if you know how this action will affect your site.

#1 How to stop WordPress default image sizes

Return to your WP Dashboard, then go to Settings => Media from the side menu.

You’re now at the Media Settings screen. Write down—or do a screengrab—of the default image sizes in case you need to change them back later.

Set the values to 0 for the Width and Height of the image sizes.

Click Save Changes.

This action disables WordPress from generating the three default image sizes when you upload new graphics files.

How to stop theme-generated images

Your active theme also generates images with new file uploads. The number of supported image sizes varies between themes. Most store the image size code in the functions.php file.

Make a copy (backup) of the theme’s functions.php file before continuing. That way, you can quickly restore the original version if something goes wrong.

Read How to Open and Edit Your Functions.php File first if you need help.

Go to Appearance => Theme Editor from your Dashboard side menu.

Click the functions.php link in the Theme Files column (right) to open the file.

Now copy the code below to your clipboard:

add_image_size

Click inside the functions.php file and press CTRL + F to bring the search box into view.

Paste the copied code from above (CTRL + V) into the search box and hit enter.

Delete the line of code beginning with add_image_size (there may be none or several).  

It looks like this: add_image_size( ‘homepage-thumb’, 220, 180, true );

Continue to search and delete these lines of code until there are no more results.

After deletion, your theme will no longer generate those image sizes.

Move to the next step when you’re done or if your search didn’t find any results.

The active theme for this site didn’t have any of the above code.

Copy the code below to your clipboard:

set_post_thumbnail_size

Click inside the functions.php file and press CTRL + F to bring the search box into view.

Paste the copied code from above (CTRL + V) into the search box and hit enter.

Delete the entire line of code that contains set_post_thumbnail_size…

Your theme will no longer generate post thumbnail sizes.

View the results

Upload a new image from the WP Dashboard and check the Uploads folder in File Manager. See “How to access your server” above if you need to recap. The WP and theme-generated images will be gone or reduced based on your actions above.

That’s it. You now know how to prevent WordPress and the active theme from generating multiple image sizes with every new upload.

Share on facebook
Share on twitter
Share on email

Subscribe to my newsletter

Subscribers to my newsletter get all the latest news, reviews, advice and gossip in the world of search engines, internet marketing, self-publishing, and North Wales (where I live). You can sign up for my free newsletter by clicking this link.

My Books

I have a range of webmaster related books for sale on Amazon in both Kindle and Paperback formats. WordPress, SEO & Self-Publishing.
On Amazon

My Online Courses

My courses cover a range of webmaster related skills, from learning WordPress itself, to installing an SSL certificate on your site.
On Udemy

Comments

Hello, I'm
Andy Williams!

You can get up to 90% off my Online Courses for webmasters, marketers & affiliates (plus a free course on Gutenberg).

Get my newsletter
delivered to your inbox

18748

We respect your privacy

18749