How to Clean Up WordPress Media Library

WordPress media library cleanup on a desktop screen

Unused uploads, duplicate files and old featured images make the WordPress media library harder to manage. They also add weight to backups and can waste hosting storage.

Use this checklist to remove files safely and stop the library filling up again.

Why Your Media Library Gets Bloated

Every time you upload an image, WordPress automatically creates multiple copies in different sizes (thumbnail, medium, large and full). Your theme and plugins may create additional sizes too.

Over time, you end up with:

  • Multiple copies of every image
  • Orphaned images from deleted posts
  • Test uploads you forgot about
  • Old featured images you replaced

This affects your site in several ways:

  • Backups take longer because there are more files to copy
  • You may pay for hosting storage you no longer need
  • A cluttered library makes the right image harder to find

Before You Start: Back Up Your Site

Deleting media files is permanent. Before you remove anything, create a full backup of your WordPress site, including the wp-content/uploads folder.

You can use a backup plugin such as UpdraftPlus or Duplicator, or the backup tool provided by your host.

Method 1: Manual Cleanup via WordPress Dashboard

For smaller cleanups, you can work directly in WordPress.

Find Unattached Images

Go to Media → Library in your WordPress admin. Switch to list view (the icon next to the search box), then look for the Unattached link at the top.

Unattached images are not connected to any post or page. Review them carefully because some may still appear in widgets, theme settings or page builders that do not create attachments.

Delete Individual Files

Click on any image to open its details. Scroll down and click Delete Permanently. This removes the file from both the database and your server.

Bulk Delete

In list view, check the boxes next to multiple images, then select Delete Permanently from the Bulk Actions dropdown and click Apply.

Method 2: Use a Media Cleanup Plugin

For larger libraries, a plugin can scan the site and flag files that appear to be unused.

Media Cleaner

Media Cleaner scans posts, pages and other content to find media files that are not used anywhere. It moves them to a trash folder first, so you can review them before permanent deletion.

How to use it

  1. Install and activate Media Cleaner
  2. Go to Meow Apps → Media Cleaner
  3. Click Scan to analyse your library
  4. Review the results. The plugin shows why each file is flagged
  5. Delete files you confirm are unused

The free version handles basic scanning. The Pro version ($29/year) adds support for page builders such as Elementor, Divi and WPBakery.

WP-Optimize

WP-Optimize is a multi-purpose optimisation plugin. Its media features let you find orphaned images and compress existing files.

JEPO (Just Erase Picture Orphans)

JEPO targets orphaned media attachments in your database. It is a narrower option than a full cleanup plugin, so test it on a staging copy first if your site uses custom media fields or a page builder.

Method 3: Prevent Future Bloat

After the cleanup, reduce the number of image files WordPress creates for each upload.

Disable Extra Image Sizes

Go to Settings → Media and set all dimension values to 0. WordPress will only keep the original upload.

Some themes and plugins rely on specific image sizes. Test your site after making this change.

Only Upload What You Need

Resize images before uploading. A 5000px-wide photo does not need to be uploaded at full size if it is only displayed at 800px.

After Cleanup: Optimise Your Database

Deleting media files removes the files from your server, but database entries may linger. Run a database optimisation to clean up orphaned attachment records.

Plugins such as WP-Optimize or Advanced Database Cleaner can handle this automatically. If the cleanup is part of a wider speed pass, this guide to speeding up WordPress with Cloudflare cache preloading covers the next layer of performance work.

How Often Should You Clean Up?

For most sites, a quarterly cleanup is enough. If you publish content daily or have several contributors, monthly cleanups help keep things manageable.

Set a calendar reminder so media cleanup becomes routine maintenance rather than a large recovery job.

What to Do Next

Back up first, remove only files you have reviewed, then limit future image sizes so the library stays manageable. For most WordPress sites, that gives you a cleaner media library in about 30 minutes.

Need expert WordPress support?

Whether it's custom development, performance issues, or ongoing maintenance—we've got you covered. Let's talk about keeping your WordPress site running at its best.