How To Clean A Bloated WordPress Media Library

5 rules for how to properly manage your Wordpress Media Library... and some tools I used to shrink a 5GB library by about 45%!

I was working with a client site recently that had one of the most bloated Wordpress Media Libraries I’d ever seen. It was so big, in fact, that it was taking up too much disk space on his hosting account and I couldn’t even create a staging site without it failing due to insufficient disk space.

So, in this post, I’d like to talk about a couple of VERY important things on how you manage your Media Library:

  • How to keep your media files efficient so as not to bloat your Media Library
  • How to clean up a Media Library that is already full of crap.

Let’s get going…

How The Wordpress Media Library Works

When you upload a file (usually an image) to your Media Library, a few things happen:

  • The file gets stored on the file system of your server.
  • A corresponding entry gets saved in your Wordpress database.
  • Wordpress may generate multiple versions – of different sizes – of the same image.

So, when you are going through your media library in your Wordpress admin, it is pulling those entries out of your database. The files themselves are sitting on the file system and the database just has a record of where they are.

Also, when you insert an image, you have different sizes available (large, medium, thumbnail, etc.). All of those sizes sit on the file system as well. Sometimes, themes and plug-ins define their own custom image sizes, too. So, what happens is that every image you upload might turn into 5 or more separate files behind the scenes.

Much of the time, these custom image sizes aren’t even used. Yet, they sit there and take up disk space on your server.

If you want to take a look for yourself, all you need to do is log into your server via FTP or using your web hosts file manager. Navigate to the folder for your site called /wp-content/uploads/. What you will usually see is a list of folders by year. Inside each year you will have folders for months. And inside each of those folders, you will find the actual image files.

5 Rules For An Efficient Wordpress Media Library

The best option for keeping things nice and clean here is to use good habits to begin with.

Some of these good habits are very important for your site’s load time and, therefore, your SEO. This isn’t just a matter of disk space. Bloated images slow down your site and that means Google is liable to penalize your site or downgrade your potential search rankings.

Further Reading: The Ultimate Guide To Search Engine Optimization For Bloggers

So, you have every reason in the world to get this right. 🙂

Let’s dive in…

#1 – Use The Correct Image Formats

You have different kinds of image files, such as JPEG, GIF, PNG, etc.

One of the most common mistakes is to use PNG files when there is no reason to. A PNG file uses less compression natively and that means the file sizes will be bigger. PNG files are best used when you need a transparent background. If the image you are uploading does not have a transparent background (like a typical photo), then uploading it as a PNG is simply going to make it unnecessarily large.

JPEG is, by far, the preferred image format. It has higher compression, meaning lower file size. JPEG does not support transparent backgrounds, though, so that’s when you should use a PNG.

GIF used to be quite common, but today really should only be used if you want an animated GIF image.

Here’s a fairly well done infographic from Visually that spells out a lot of this…

Free Membership Will Get You...

Ability to participate in our forum community, access to exclusive downloads in the library, plus an exclusive subscription to THE EDGE. Sent each Monday, The EDGE will keep you on the cutting edge of Wordpress-based business.


Join The Community (For Free). You'll Get...

Create Your FREE Account!

Join and participate in the community, access exclusive resources in the Document Vault, and get a free subscription to THE EDGE.

Your membership is free for life.