How to Remove Unused Images from WordPress

Over time, the disk space that a typical WordPress website uses increases due to images being uploaded every day. One way to address this is to remove any images that are not being used by your website. That is, images that are not referenced by your database, theme, or plugins.

Images may be unused for a number of reasons. The most obvious example are images that are uploaded to your website but are not actually being displayed. It is something that is difficult to stop if you run a multi-author website since writers tend to just upload another image if they discover the original image that was uploaded is not suitable.

However, WordPress creates a lot of unused images too; which can result from cropping images or scaling images. Unused thumbnail images can take up a lot of disk space too.

WordPress themes are usually designed to create multiple thumbnail sizes whenever an image is uploaded; yet these images may not actually be used on your website.

In this article, I would like to show you three useful plugins that allow you to remove unused images and unreferenced images from your website.

Due to the nature of these plugins, I highly recommend you back up your database and your WordPress uploads folder. This will allow you to restore your website in the event of a plugin deleting images that were actually being used on your website. The risk of this happening is small if you take the time to review the images that will be deleted, however I still believe it is prudent to try these plugins on a test website first so that you understand what types of images they will delete.

Cleanup Images

Partially based upon DNUI Delete Not Used Image, Cleanup Images is a user friendly WordPress plugin that scans your media library for unused images. It allows you to change the number of images that is displayed per page and whether items are listed by newest first or oldest first.

Cleanup Images

The file name and image path of each image is displayed for each unused image.

At the bottom of the page is an option to select and deselect all unused parent images and/or unused child images. This will help you delete hundreds of unused images at a time.

Cleanup Images

Image Cleanup

Image Cleanup scans your website for unreferenced images. These are images that have been uploaded to your website but are not indexed by your database or referenced by posts or plugins.

The main plugin page allows you to change the number of images and posts to process in each step. Images can be skipped from the scan if you specify the folder or absolute path of the images.

Once you have indexed images, the plugin will break down all of your images into categories such as Valid Attachment Meta, Unreferenced Used Images, and Unreferenced Unused Images.

Image Cleanup

The plugin will show useful information for valid image attachments such as filename, dimensions, meta ID, and image path. You can also see images without meta details that are being used. No actions can be performed for used images. The information simply lets you see a summary of the images that are being used on your website.

Image Cleanup

Checkboxes will appears next to unused images. You can check the list of images and look at which ones should be deleted. In my test website, I found most unused and obsolete images to be automatically generated thumbnails.

Image Cleanup

Simply select the images you want and move them or delete them. The checkbox at the top of the page allows you to select all images.

Image Cleanup

* Please note that the original version of this article intended to include DNUI Delete Not Used Image, however the plugin did not function correctly for me, despite no other plugins being installed. Other WordPress users have reported that it works fine for them, so you may want to consider checking it out.

I found you found this article useful. If you used one of the above plugins to delete unused images from your websites, I would love to hear how many images and how much space it helped you save.

Good luck.
Kevin

I am an experienced blogger who has been working on the internet since 2000. On this blog, I talk about WordPress, internet marketing, YouTube, technology and travelling.
Share This