How to Identifiy & Bulk Remove unused images

I've got a site that has many images that have never been used that I'd like to delete from the media library. They add to the backup size and it's harder to manage

I've seen some plugins that claim to do this, but they don't scan galleries, sliders or custom post types. I also want to keep all size versions and not just the original and thumbnail.

Any ideas on the best way to approach this?

  • Tyler Postle

    Hey Anne,

    Hope you're doing well today and thanks for your question!

    Have you checked out a plugin such as this? https://wordpress.org/support/plugin/dnui-delete-not-used-image-wordpress

    This is a difficult process because it may not catch all images or it might think images aren't being used when they in fact are.

    Another option is to go into your media library and sort by "uploaded to" then ones that aren't attached to a post you could consider deleting. Just keep in mind that if you have manually linked to them then they won't show as being attached to a post even though they are still being used.

    Yet another option, instead of deleting the images is just optimizing them all for size. You could use our free smush it plugin: https://wordpress.org/plugins/wp-smushit/ to reduce the file size :slight_smile:

    Let me know if either of these options do the trick for you! More than happy to discuss further if needed.

    All the best,
    Tyler

  • Tyler Postle

    Hey Anne,

    Thanks for your feedback here. Kraken does look awesome! Surprised I haven't heard of that one before. Thanks for mentioning it.

    Another one I've seen a lot of members here using is Imsanity: https://wordpress.org/plugins/imsanity/

    It has a bulk re-size feature too. I'm betting you have probably heard of that one already too though :p

    Hope this helps. Let me know if you have any further questions.

    Cheers,
    Tyler

  • Sheryl Hohman

    Have you guys though about writing a plugin to scan everything for safe removal of images ?
    It seems to be a problem that does not YET have a complete or satisfying solution.

    I have tons of images that I had uploaded and stored years ago. Then there have been many website redesigns, and optimizations on previously uploaded images. It just grew.. and when I first started, of course I didn't know what I was doing..

    Now I have a monster that I need to tame, for site migrations, etc.

    Seems there is quite a lot of room available in the market for something like this.
    I don't necessarily want to remove ALL unused images. But there are a heck of a lot of duplicates. And a ton of experimental images that can simply be discarded. The task is so overwhelming, that it keeps growing.

    I've looked for a secure, satisfying solution several times over the years, and the resulting searches are slim, and often not up to date.

    Thanks !

    • Tyler Postle

      Hey Sheryl Hohman, thanks for adding your feedback!

      This still isn't something we have planned, but I will pass this along and perhaps it could happen in the future :slight_smile:

      I can definitely see how it would affect a lot of WP users. The difficult part is that there are so many ways to add images, it would have to scan all your content to see if the file name is being used anywhere then delete it if not, and do that for every image - which would be extremely resource intensive. I'm thinking that is likely why a solution doesn't currently exist for it, although that is coming from a non-developer. Anyways, I'll pass it along - thanks again!

      Cheers,
      Tyler

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.