As a WordPress website owner, you probably don’t think much about your media library. But over time, obsolete images can build up and slow down your website and backups.
In this article, I will explain how finding and deleting old, unused images can greatly reduce your backup size and time. This will reduce the time and money you must spend on these tasks and resources.
Why Old Images Make Backups Bigger
I run many business websites and use the WordPress backup plugin WP Staging to ensure that I have a backup in place when I – again – break it with some of my experimental code.
The more new posts on the site, the more often I make a backup. Unfortunately, they take up much disk space on my main and backup servers, so I always want to reduce the size. The benefit of this is usually in the double-digit percentage.
Unlike text, images can’t be compressed much. So, each old image adds a lot to the size of your backups. The easiest solution to this is to create different backup plans. One that includes the media library and runs less often, and another one that excludes the media library and easy-to-recover folders like plugins.
Also, many publishers aren’t aware that WordPress automatically generates multiple files from a single image to show only sizes that match the user’s device. What is great for speed is a horror for backup sizes.
The more new articles and images on your site, the more you need to backup the media library. Before you do that, though, you might want to clean it up from no longer used files.
Finding Outdated Images
WordPress Core does not offer a stable solution to find outdated images in your media library. The “Uploaded to” information only applies to images uploaded via the post editor and is not updated when that connection is severed. If you have time and are technically capable, you can use database queries, as explained with examples in Find Unused Images. Still, you might end up like I and need your WordPress backup plugin to recover from issues.
That’s why I recommend a media cleaner plugin like Image Source Control. It indexes your images and finds the ones not actively used on your site.
The “Unused Images” section with the plugin shows you the number of files per image and combined disk space the removal of an image can save you.
This list of unused images is filled while you use your site. So you won’t miss it when an image is no longer used. I review this list during my monthly maintenance work, which takes me less than a minute.
The “Deep Check” option digs deep into your database, ensuring that an image is not used in any options or meta information before you can clean it.
Over time, unused images get into all WordPress sites. Don’t let them silently bloat your backups. Removing them right now will positively affect every future backup you run.
Install Image Source Control and regularly review outdated images to delete. You’ll be surprised how much space you recover.
About the Author
Thomas Maier is a popular German web developer and founder of a few very popular WordPress plugins. One of his recent projects is Image Source Control.