How To Delete Unused Images in WordPress: A Step-by-Step Guide

wordpress delete unused images

If you’ve been using WordPress for a while, your media library is probably filled with images—some you use regularly, and others you’ve long forgotten about. These unused images can pile up over time, taking up unnecessary space on your site and potentially slowing things down. Worse, it can become a hassle to find the images you actually need.

What this means is that you have to clean up these unused images so that your library is uncluttered. In this step-by-step guide developed by expert WordPress developers, we’ll show you how to easily identify and delete those unused images, freeing up space and keeping your site running smoothly. Let’s get started.

Where Are Images Stored in WordPress?

In WordPress, images are stored in two places:

  • The image files themselves are saved on the server, usually in the ‘wp-content/uploads’ folder.
  • There’s also a record of the image in your Media Library. This record includes details like the image title, description, and alt-text.

When you delete an image, both the image file and its record in the Media Library will be removed.

Why Cleanup WordPress Media Library?

Imagine your media library is like a closet. Over time, you keep adding stuff to it—photos, graphics, random files—but you never really clean it out. What happens? It gets messy, cluttered, and hard to find what you actually need. 

Same is the case with WordPress media library. It needs a cleanup from time to time to make sure everything runs smoothly.

Few reasons why cleaning it up is super important are:

  • Saves Space: Unused images take up storage on your server. If you’re on a hosting plan with limited space, this can be a problem. Cleaning up means more room for the stuff that really matters.
  • Speeds Up Your Site: Too many files can slow down your website. And let’s be honest, nobody likes a slow website. By removing unused images, your site can load faster, which is great for visitors (and Google too!).
  • Keeps Things Organized: A clean media library makes it easier to find the images you actually use. No more scrolling through hundreds of old files to find that one picture you need.
  • Better Backups: If you back up your site regularly, smaller backups mean less time and storage needed. Plus, restoring your site becomes quicker if something goes wrong.

In short, taking a little time to clean up your media library can go a long way in keeping your WordPress site efficient and organized.

Make WordPress Management Easy With our Experts!

Steps to Delete Unused Images in WordPress

Deleting unused images on your WordPress site is easy. There are three different ways you can do it:

Deleting Images Manually

To delete unused images in WordPress manually, the process is simple.

Step 1. Access your WordPress dashboard, then click Media → Library. This will display all files that are uploaded to the site.

media library

Step 2. Look for a drop-down menu that says ‘All Media Items’  and click on ‘unattached’  from the list.

all media items in the media library

This will display all the images that are not in use. You can delete these images one by one. 

Step 3. Select the images one by one that you want to delete and click on ‘Delete permanently’.

Delete permanently option in media library

If you want to delete more than one image at once, then select ‘Bulk Select’

bulk select

Select the images that you want to delete and click ‘Delete Permanently’.

select images

If your site has hundreds or even thousands of images, manually deleting the ones you don’t need is nearly impossible. Plus, it’s hard to tell which images are duplicates.

On top of that, you’d need to know exactly which images are being used on your posts and pages to avoid deleting the wrong ones. But don’t worry—there’s a much easier way. Instead of hunting through everything one by one, you can use a plugin to help you find and remove unused images safely.

Delete Unused Images Using Media Cleaner

Cleaning up unused images on your WordPress site doesn’t have to be a hassle. With the Media Cleaner plugin, you can quickly find and delete images that aren’t being used anywhere on your site.

Here’s how to do it:

Step 1. Install the Media Cleaner plugin. Go to your WordPress dashboard, click on “Plugins” > “Add New.” 

add new plugin

Step 2. Search for “Media Cleaner,” and hit “Install Now.” 

media cleaner plugin install

Once it’s installed, activate the plugin.

media cleaner plugin activation

Step 3. After activation, you’ll see a new option in your WordPress dashboard for Media Cleaner. Click on it, then hit “Scan.” The plugin will go through all your images and check which ones are not being used on any of your posts or pages.

Step 4. Once the scan is complete, you’ll get a list of images that are no longer in use. You can go through this list and decide if you want to delete them. The plugin will even ask for your confirmation before removing them, so you won’t accidentally delete anything important.

That’s it! The Media Cleaner plugin makes it easy to tidy up your media library without the stress of manual checking.

Delete Duplicate Images Using Media Deduper

If you’ve uploaded the same image more than once, you might have duplicate files taking up unnecessary space. The Media Deduper plugin can help you find and delete these duplicate images in just a few steps.

Here’s how to use it:

Step 1. Install the Media Deduper plugin. Just like with Media Cleaner, go to “Plugins” > “Add New,” search for “Media Deduper,” and click “Install Now.” Once it’s installed, activate the plugin.

Step 2. Once activated, a warning will pop up asking you to generate the media list. You can click on the warning or go to Media, then Manage Duplicates.

manage duplicates

Step 3. Click on Index Media to analyze all the media files in your library.

index of duplicate media

Step 4. Next, click on the Duplicates tab to see a list of all the duplicate media files the plugin has found.

duplicates

Step 5. When Media Deduper finds more than one copy of the same image, it will show all the duplicates in the list. It’s up to you to choose which version of the image you want to keep.

Keep in mind that when you see the list of duplicates, if you delete all of them, the image will be completely removed from your library. This means any posts or pages using that image will no longer display it.

But don’t worry! The plugin has a Smart Delete feature to help prevent accidental deletion of all copies.

smart delete option

For example, let’s say we have three copies of the same image. If we try to delete all of them using the Smart Delete option in the Group Actions menu, here’s what happens: after we confirm the deletion, the plugin will tell us that two copies were deleted, but one was kept.

deleted item information

This is a safety measure to stop you from deleting all versions of the image by mistake.

Which copies were deleted?

If one of the images was used on a page or post, deleting the duplicates might make that image disappear from the posts. To make sure you’re only removing unused images, you can use the pro version of the plugin. This will ensure you only delete the images that aren’t attached to any posts.

Alternatively, when you choose which images to delete, you can check if they’re attached to any posts. Each image will show which post it’s used in, so you can be sure you’re not deleting something important.

Some other benefits of Media Deduper include:

 Media Deduper doesn’t just help us get rid of duplicates—it also stops us from accidentally uploading the same image more than once.

If you try to upload an image that’s already in your library, you’ll see a warning message, like this:

warning message

The cool thing is, it doesn’t matter if the new image has a different name. The plugin will still catch it and prevent the duplicate, saving you space.

If you ever want to turn off this feature, you can easily do that in the plugin settings. Just go to Settings → Media Deduper.

media deduper setting

In the settings menu, uncheck the “Disable duplicate upload blocking” box, and that will turn off the feature that prevents uploading duplicates.

Disable duplicate upload blocking

That’s it! Now you know how Media Deduper helps keep your library neat and free of unnecessary duplicates.

Simply put, you can delete unused images in WordPress manually or with plugins like Media Cleaner and Media Deduper to find and remove unused or duplicate images. 

Optimizing Your WordPress Media Files

After deleting duplicates, it’s a good idea to optimize the rest of your images.

Many new website owners upload high-quality images straight from their phones or cameras. These images are often too big and take up a lot of storage space, which can:

  • Increase the size of your backups.
  • Slow down your WordPress site.

To fix this, you can:

  • Resize images before uploading them to save space.
  • For more tips, check out our step-by-step guide on optimizing images for web performance.

Alternatively, you can use a WordPress image compression plugin to automatically optimize your media files without losing quality. This keeps your site faster and more efficient.

In short, optimizing your media files is important to save space and improve site speed. You can resize images or use an image compression plugin to reduce file sizes without losing quality.

Need help with your WordPress site? Talk to our experts!

FAQs on Deleting Unused Images in WordPress

How do I bulk delete images in WordPress?
To bulk delete images, go to your Media Library, select Bulk Select, choose the images you want to delete, and then click Delete Permanently.
What is the WordPress plugin that deletes unused images?
The Media Cleaner plugin helps you find and delete unused images from your WordPress site.
How do I delete unattached images in WordPress?
To delete unattached images, go to Media Library, select the Unattached filter, and delete the images that are not being used on any posts or pages.

Summing Up

Cleaning up unused and duplicate images on your WordPress site is an easy way to free up space, speed up your website, and keep things organized. Whether you choose to delete images manually, use the Media Cleaner plugin, or find duplicates with Media Deduper, these steps will help you maintain a tidy and efficient media library. 

Additionally, don’t forget to optimize your images to further enhance your site’s performance. Resizing images or using an image compression plugin ensures your site loads faster without sacrificing quality. 

Taking these steps will help ensure your WordPress site remains fast, organized, and efficient, making it easier for both you and your visitors to navigate. If you want to build a custom WordPress site, our expert WordPress developers can help.

author
Chinmay Pandya is an accomplished tech enthusiast specializing in PHP, WordPress, and Laravel. With a solid background in web development, he brings expertise in crafting innovative solutions and optimizing performance for various projects.

Leave a comment