How to remove unused images in WordPress

If you’ve been running your blog for a while, you are likely to have a large number of posts and pages, and consequently a large number of images. It’s a common occurrence to change and edit your content, this often includes changing and removing images, simply deleting certain posts, all resulting in a fair amount of unused and unattached WordPress images.In this article we’re going to look at how to remove unused images in WordPress, this can be achieved via manual image management, and also via more automated methods, which are a lot quicker if you’re working with a large number of images.

Manual Image Removal

Removing unused images may be ok if you’re dealing with a small number of images, but otherwise this method can be a real chore. That said, it isn’t difficult, so let’s have a look at how you can achieve it.
If you’re going to do this manually, first let’s look at the way NOT to do it. If you go to your Media Library (Media > Library) and view the ‘Unattached’ images list, you might think that just deleting all of these would be an easy solution.

Wordpress Unattached Images Filter

WordPress Unattached Images Filter

The thing is, whilst images that are not used in your posts are listed as ‘Unattached’, custom graphics and images used in other parts of your website may also be listed here, along with images from pages you may have saved as drafts, so if you just delete all images from the ‘Unattached’ list, you are likely to delete some images that you actually want to keep.

So, if you’re going to do it manually, you have to be very selective and careful about the images you choose to delete. If you’re happy to spend time doing this, then the above method can work. Alternatively, you could manually sort through your ‘WP Uploads’ folder via an FTP client, again, real care is required.


Removing Unused Images with a Plugin

By using a dedicated plugin for the job, you can have fine control over what gets deleted, and more importantly, you can also save yourself an awful lot of time and stress, so let’s look at a couple of the best plugins for removing unused images in WordPress. We recommend that you make a backup of your WordPress database and files before using any automated method.

Image Cleanup Plugin

Wordpress Image Cleanup Plugin

WordPress Image Cleanup Plugin

This is a really nice plugin that will scan your WordPress install and list all the unused and unreferenced images in your database. These could be images that you’ve cropped and changed, unused images from deleted posts and pages, and also different sizes of images that are never used in your theme. All things considered, this is an excellent plugin that also has really solid documentation and instructions, so is well worth checking out.

Download Plugin

DNUI Delete Not Used Image

The DNUI Delete Not Used Image plugin scans your posts and pages, and easily identifies all images that are currently unused. It’s obviously worth double checking the results before you delete the images of course, but in my experience, this plugin always manages to get it right.

Download Plugin

Leave a Reply

Your email address will not be published. Required fields are marked *