How to Clean Up WordPress Media Library

WordPress website development on monitor

Your WordPress media library can quickly become cluttered with unused images, duplicate files, and forgotten uploads. This bloat slows down your site, increases backup sizes, and wastes hosting storage.

Here’s how to clean it up properly.

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:

  • Slower backups – More files means longer backup times
  • Higher storage costs – You may be paying for space you don’t need
  • Harder to find images – A cluttered library is difficult to navigate

Before You Start: Back Up Your Site

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

You can use plugins like UpdraftPlus, Duplicator, or your hosting provider’s backup tool.

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 aren’t connected to any post or page. Review them carefully – some may still be used in widgets, theme settings, or page builders that don’t 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 thorough cleanups, plugins can scan your entire site and identify truly unused files.

Media Cleaner scans your posts, pages, and other content to find media files that aren’t used anywhere. It moves them to a trash folder first, so you can review 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 like Elementor, Divi, and WPBakery.

WP-Optimize

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

JEPO (Just Erase Picture Orphans)

A lightweight option that specifically targets orphaned media attachments in your database.

Method 3: Prevent Future Bloat

Stop WordPress from creating unnecessary image sizes.

Disable Extra Image Sizes

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

Note: 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 doesn’t need to be uploaded at full size if it’s 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 like WP-Optimize or Advanced Database Cleaner can handle this automatically.

How Often Should You Clean Up?

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

Set a calendar reminder so it becomes routine rather than a major project.

Summary

A clean media library improves site performance and makes content management easier. Back up first, use a plugin like Media Cleaner for thorough scanning, and prevent future bloat by managing image sizes.

The process takes about 30 minutes for most sites – time well spent for a faster, leaner WordPress installation.

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.

Book a Discovery Call