Back to Blog
Keywords
  • WordPress
  • Media Library
  • Performance
  • Plugins
  • Tutorial

How to Find and Delete Unused Media Files in WordPress (Without Breaking Your Site)

Alexis Olivero
Alexis Olivero
How to Find and Delete Unused Media Files in WordPress (Without Breaking Your Site)
Share:

Your WordPress media library has a problem you probably don't know about.

Every time you upload a new image, WordPress generates multiple thumbnail sizes automatically. Every time you switch themes, rebuild a page, or update a product photo in WooCommerce, the old files stay on your server — silently taking up space.

The average WordPress site has hundreds of files that are never referenced anywhere. Some sites have thousands.

The real danger isn't the wasted space — it's what happens when you try to clean it up. Most media cleaner plugins mark files as "unused" without telling you why, and without checking every place they could be referenced: page builder data, ACF fields, WooCommerce galleries, widget settings, theme mods.

One wrong delete and your site breaks.

This guide shows you how to find and remove unused media files safely — with full visibility into where every file is used before you touch anything.

#
Why WordPress media libraries get out of control

WordPress doesn't clean up after itself. When you:

  • Upload multiple versions of the same image to find the right size
  • Switch themes that generated different thumbnail dimensions
  • Redesign a page and replace images without deleting the old ones
  • Discontinue WooCommerce products but leave their images behind
  • Use page builders that store copies of images in their own format

...every file from every one of those actions stays on your server.

Most hosting providers charge by storage. And even if yours doesn't, a bloated media library slows down backups, makes migrations painful, and adds noise to an already hard-to-manage media browser.

#The real risk: deleting files your site still needs

Here's the problem other guides don't mention: not all "unused" files are actually safe to delete.

A file might not appear in any post's post_content column — and still be actively referenced by:

  • An Elementor widget storing image data in its own JSON format
  • An ACF image field storing only the attachment ID, not the URL
  • A WooCommerce product gallery stored as a comma-separated list of IDs
  • A Divi module with image data in custom post meta
  • A theme mod (logo, header image, background)
  • A widget in a sidebar

Plugins that only scan post_content will tell you those files are unused. They're wrong. Deleting them breaks your site.

#The right way to clean your media library

#Step 1 — Install OliveroDev Media Audit (free)

Download it from WordPress.org and install it like any other plugin. Go to Tools → OliveroDev Media Audit.

#Step 2 — Run a full scan

Click Start New Scan. The plugin scans in batches so it won't time out even on large libraries. You'll see a real-time counter showing how many files have been processed.

The scanner checks:

  • All posts, pages, and custom post types
  • Post meta and serialized data
  • Theme mods (logo, header, background)
  • Widget data and options table
  • Featured images
  • All registered image sizes

#Step 3 — Use "Where is it used?" before deleting anything

This is the feature that makes all the difference.

For every file marked as Used, click the "Where?" button. The plugin shows you the exact post, page, or setting where that file is referenced — with a direct link.

This means you can verify with your own eyes before making any decision. No guessing.

#Step 4 — Review unused files with confidence

Files marked as Unused were not found in any of the locations above. The plugin shows:

  • File name and preview thumbnail
  • File size
  • Type (image, document, video, archive)

Before deleting, click the Delete Permanently button. A confirmation modal appears showing the thumbnail, filename, and size — so you know exactly what you're removing.

#Step 5 — Export a report if you need approval

If you're cleaning a client site or need to document what you're removing, use the Export CSV button in the Unused Files tab. It generates a spreadsheet with filename, URL, size, type, and upload date for every unused file.


Going deeper: what PRO adds

The free version covers the most common cases. If you're working on sites that use Elementor, ACF, Divi, WooCommerce, or similar tools, the PRO version adds:

Deep Detection — scans _elementor_data JSON, ACF integer fields, WooCommerce product galleries, and Divi meta to catch references the free scanner can't see.

Risk Scoring — every file gets a score from 0 to 100. High score means safe to delete. Low score means the file has characteristics (branding name, recent upload, ALT text, multiple references) that suggest caution.

PRO Trash — instead of deleting immediately, move files to a temporary trash. Restore them in one click if you change your mind. Permanent delete only when you're sure.

Bulk Cleanup by risk level — move all low-risk unused files to PRO Trash in one operation, instead of one by one.

Try PRO free for 3 days — no credit card required

#How much space can you recover?

It depends on your site's history, but results are often significant:

  • A site that has been live for 3+ years typically accumulates 500MB–2GB of unused media
  • WooCommerce stores with frequently updated product catalogs often have more unused files than used ones
  • Sites that have changed themes more than once almost always have entire sets of obsolete thumbnail sizes

After running the scan, the Dashboard shows the exact recoverable size before you delete anything.

#Summary

Cleaning your WordPress media library is safe if you do it with full information. The mistake most people make is using a tool that tells them what to delete without telling them why it thinks it's safe.

OliveroDev Media Audit was built to give you that information first — and the tools to act on it confidently.

Download free on WordPress.org

Next Step

Need your website to convert better too?

I can review your site, find the biggest friction points, and map clear improvements for performance, SEO, UX, and sales.

Alexis Olivero

Alexis Olivero

IT & Frontend Developer specialized in building modern digital solutions with a strong focus on user experience, performance, and scalability. Experienced in WordPress, Webflow, and frontend technologies, applying product thinking and IT best practices to create efficient, secure, and business-oriented web platforms.

Share this article