Over time, every WordPress media library fills up with images nobody uses: old headers, draft photos, files uploaded twice. They take up storage, slow down backups and make the library hard to manage. Deleting them sounds simple, but deleting the wrong file breaks pages. This guide shows how to clean up safely.
Why WordPress makes this hard
WordPress does not keep a reliable record of where each file is used. The media library can tell you which post an image was first uploaded to, but not much else. An image can still be in use in many places WordPress does not track directly:
- Inside page builder layouts (Elementor, Gutenberg blocks, and others)
- In custom fields and theme options
- As a featured image or a category or tag thumbnail
- In widgets, menus or shortcodes
- Hard-coded in a theme's CSS or templates
So "unattached" in the media library does not mean "unused". Deleting files based on that label alone is the most common way people break their sites.

Step 1: Back up first
Before deleting anything, make a full backup of your files and your database. Most hosts offer one-click backups, or you can use a backup plugin. If something goes wrong, you can restore in minutes.
Step 2: Find what is actually unused
You have two options.
Option A: Check by hand
For a small site with a few dozen images, you can check manually:
- Open Media › Library and switch to list view.
- For each image you suspect is unused, copy its file name.
- Search for that file name in your posts and pages, and check your theme settings and widgets.
- If it appears nowhere, note it as a candidate for deletion.
This works, but it is slow, and it is easy to miss images used in page builders or custom fields.
Option B: Use a plugin that scans for usage
For anything larger than a handful of files, a scanner is faster and safer. Our free plugin, MGCora Unused Media Cleaner, was built for exactly this:
- Install it from Plugins › Add New by searching for "MGCora".
- Open Media › Unused Media and start a scan.
- Choose a scan depth: Quick checks the media table, Standard checks posts, pages and custom fields, and Deep also checks metadata, shortcodes, page builders and theme files.
- When the scan finishes, each file is marked Used or Unused.
It only flags files. Nothing is deleted until you choose to.
Step 3: Review before you delete
Never bulk-delete straight from a scan result. Review the list first:
- Open the details for anything important. In Unused Media Cleaner, the details view shows exactly where a file is used, so you can confirm a file really is unused.
- Watch out for recent uploads. A file added to a draft or a scheduled post may look unused today.
- Keep brand assets. Logos and icons might be used outside WordPress, for example in emails.
Step 4: Delete to the trash, not permanently
Move files to the trash rather than deleting them permanently. Then browse your key pages: the home page, your top service pages, your shop or booking pages. If something looks broken, restore the file.
Unused Media Cleaner re-checks each file at the moment you remove it and keeps removed files in its own trash, so a mistake is one click to undo. Once you are confident everything works, empty the trash to free up the space.
How often should you clean up?
For most sites, once or twice a year is enough. It is also worth doing after a redesign, when many old images stop being used at once.
Summary
- "Unattached" in WordPress does not mean unused.
- Back up first, scan for real usage, review the results, and delete to the trash before removing anything permanently.
- A usage scanner like Unused Media Cleaner makes this faster and much safer than checking by hand.


