3 Ways to Find & Delete Unused Image Files

Once you’ve cleaned up and deleted unused plugin tables in your database, you may also want to find and delete unused images in your media library.

There’s different plugins which enable you to do this which i have tested on a local installation of WordPress.

Of course you could also go through your files in the media library and delete your unattached files manually but that just isn’t a fun way to use WordPress.

Let’s take a look at 2 plugins which make the job easier & faster.

It’s advisable to take a backup of your uploads folder & database before deleting any images stored in these directories and data in your db.

Note: WordPress creates 4 copies of each image every time you upload them to your server via your media library. This plugin finds the image files which have not been used within a post or page and displays them for deletion from both your uploads directory and database. Images you have uploaded and used in other area’s of your site will also be displayed.

WordPress Uploaded Files Cleaner

Once you install and activate this plugin, go to settings to find the link to this page.

Select The Folders You Want To Check For Unused Images

I suggest you analyze one folder at a time rather than select every year.

The reason for this is the plugin does take a while to scan all your uploads depending on how many images in each folder.

Your unused images will then be displayed on the next screen.

You can then move these files from your uploads folder to a dedicated folder.

Move all unused files from your uploads folder to a dedicated folder

When i tested this plugin, it did move the unused images to a dedicated folder but it also displayed errors after doing this.

Let’s now check out another plugin which pretty much does the same job.

DNUI ( Delete Not Used Images)

After activation of this plugin, go to settings to find the link to the page where the action takes place.

Delete Not Used Images

Here’s a tutorial you can follow directly from the plugin authors website.

Once you make a scan, the unused images will be displayed.

Scanning for then deleting Unused Images

You can view the images before deleting all the copies WordPress automatically creates of them.

This plugin worked for me no problems.

Deleting Images Manually

You can also search through your Media Library for images which are unattached to posts and pages to delete them manually.

Simply go to Media > Library and click the Unattached link which will display all images that may be displayed on other parts of your site or simply not used.

Unattached Media Files

6 responses to “3 Ways to Find & Delete Unused Image Files”

  1. Steve Gibson Avatar
    Steve Gibson

    Unattached does not mean Unused. Very dangerous to confuse the two terms.

  2. […] 3 Ways to Find & Delete Unused Image Files […]

  3. Mahesh Verma Avatar
    Mahesh Verma

    Nice information thanks for valuable post 🙂

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.