How do I delete all UNUSED images from my uploads directory?

I am trying to clean out my uploads folders as they are now starting to take up too much room on my server.

I have tried to use plugins to achieve this end such as DNUI and Cleanup Images but these plugins are either unworkable or in DNUI’s case (which has been updated recently and works) do not achieve the exact results that I am after. This is because my site uses Woocommerce and a theme which both use images within other places rather than just posts or pages such as headers, footers and galleries. It seems as if WC uses it’s own built in Lightbox plugin called Pretty Photo which is where the images that are detailed as “unused” by DNUI are called from.

I know that it is a bit of an ask but I am wondering if anybody could point me in the right direction? I am no developer, so probably should not even be posting on here, but I can work things out with time and determination. I have seen scripts on this site that achieve the same results as the DNUI plugin but nothing that takes into account other image uses (if it is even possible?). Any help would be much appreciated.


Deleting images using plugin:

You can use this plugin, it will search your database and look if image is inserted into any post (in content, as featured image, in any custom field, anywhere…) or as background…

If image is not used anywhere it will give you option to delete it.
You will get list of all images on your site not used anymore, so you can safely delete them.


and this, still work, even it is outdated

Deleting images manually:

You can also search through your media library for images which are unattached to posts and pages.

Go to media library and click the “unattached” it will display all images that may be displayed on other parts of your site or not used.

Leave a Comment