Skip to content

OG Media Cleaner

OG Media Cleaner finds media you no longer use and broken entries in your Media Library. Anything you delete goes to a private trash first, so you can check your site and restore a file if you need it.

Requires: WordPress 6.0+, PHP 8.0+ and the PHP DOM extension (for content analysis). OG Media Cleaner in the OG Nexus store

Back up first

Make a full backup of your site before you clean anything. Media Cleaner reads your content to decide what is used, and that is never proof that a file is unused. Builders, themes, custom code, CSS, JavaScript and other sites can load files in ways a scan cannot see. Emptying the trash is permanent.

Who it's for

Site owners, agencies and developers with a large or messy Media Library who want to free up disk space, speed up backups and keep the library tidy without losing content they still need.

Install and activate

  1. Download the zip from My Account > Licences on og-nexus.com.
  2. Install it from Plugins > Add New > Upload Plugin and activate it.
  3. Open the License tab in the Media Cleaner settings and activate your licence key.

The full steps are in Install and activate.

Until the licence is active, the plugin works with the basic features only: the Clean Library scan and the built-in parsers. The features marked "needs an active licence" below switch on once it is active.

Where to find it

Screen Where What it is for
Dashboard Media > Cleaner Run scans, review results, ignore, delete, recover and empty the trash.
Settings The OG menu in the WordPress sidebar, then Media Cleaner Choose what to scan, check parsers, tune performance, logs and your licence.
Media Cleaner box The side of a media item's edit screen Shows where the last scan found that file, with a link to the dashboard.
Row links Media > Library (list view) For a file in the scan results, Delete, Trash and Restore become Delete with Media Cleaner, Trash with Media Cleaner and Restore with Media Cleaner. They open the dashboard filtered to that file.

Only administrators (users who can manage_options) see these screens.

Settings

Settings save themselves as you change them.

Clean Library Scan

These settings control the Clean Library scan, which checks the entries in your Media Library.

What to scan

Setting What it does
Content (Check) Checks whether each media item is used in your content: posts, pages, other post types, metadata, widgets and more. On by default. If you turn it off, the scan only looks for broken entries (files that are missing from the disk).

Filters

Setting What it does
Images Only (Enable) Only images are scanned. Other media is left out.

More rules

Setting What it does
Attached Images (Consider as In Use) Media attached to a post (the Uploaded To field in the Media Library) counts as used.

Clean Uploads Folder Scan

Needs an active licence. These settings control the Clean Uploads Folder scan, which walks the files in your uploads folder.

What to scan

Setting What it does
Content (Check) Checks whether each file is used in your content. On by default.
Library (Check) Checks whether each file is registered in the Media Library.

If you tick both, both checks run together. This takes more time and memory, and both kinds of result show in one table. If you tick neither, you get a list of every file in the folder.

Filters

Setting What it does
Thumbnails Only (Enable) Only thumbnails are scanned. WordPress thumbnails have the size in their file name.
Directories Filter A regular expression. Only folders whose path matches are scanned. For example, /^2024/ scans the 2024 folder only. Leave it empty to scan everything.
Files Filter A regular expression. Only files whose name matches are scanned. For example, /\.pdf$/ scans PDF files only. Leave it empty to scan everything.

Parsers

A parser teaches Media Cleaner how a plugin or theme stores its media, so files used only by that plugin are not reported as unused. This tab lists the parsers that apply to your site:

  • A tick means the plugin is active and Media Cleaner reads its content.
  • A cross means the plugin is active, but its parser needs an active licence. Until then, media used only by that plugin can show up as unused.

Built-in parsers cover WordPress itself (content, blocks, galleries, featured images, widgets, theme images and the site icon), WooCommerce, OG Gallery and a few others. With an active licence you get more than 70 extra parsers for page builders (for example Elementor, Divi, Beaver Builder, WPBakery, Bricks and Oxygen), ACF, Meta Box, sliders, galleries, directories, LMS plugins and more.

Plugins that only use normal WordPress media features do not need a parser.

Advanced

Interface and logs

Setting What it does
Thumbnails (Hide) Hides the image previews in the dashboard tables.
Skip Trash (Yes) Deleting becomes permanent. Files skip the trash and cannot be restored. Leave this off unless you are sure.
Safety Checklist (Hide) Stops the Safety Checklist from showing before each scan. Needs an active licence.
Expert Mode (Enable) Adds an Expert Mode bar under the dashboard results, with Extract References, Extract References for Post ID, Reset References and Match with References. Use it to run scan steps one at a time, for example when support asks you to.
MCP (Enable) Adds the Media Cleaner tools to the MCP server of OG AI Core, so an AI assistant can scan, review results and clean up. This needs OG AI Core with its MCP module turned on. See Clean up with an AI assistant.

When uninstalled

Setting What it does
Plugin Data (Delete all) Removes the Media Cleaner tables and options when you delete the plugin. See Uninstalling.

Developer options

Button What it does
Export Options / Import Options Saves your settings to a file, or loads them from one. The page reloads after an import.
Force Clean Trash Checks the trash and removes entries and files that can no longer be recovered. Anything that can still be recovered is left alone.
Unlock Cleanup Lets you delete from the current results without a new scan. Only use it if support asks you to.
Reset Options Puts every setting back to its default.
Delete Cleaner DB Deletes all scan results, references and run history. It is blocked while a scan can be resumed or while anything is still in the trash. The tables are made again next time you open the dashboard.

Advanced Settings

These control how much work each server request does. The defaults suit most sites. Lower them if scans time out or run out of memory. Click Auto Buffer to run a Server Benchmark: it measures each scan phase on your server and suggests values. Nothing changes until you click Apply.

Setting Default Range What it does
Media Buffer 100 1–500 Media entries read per batch.
Posts Buffer 5 1–100 Posts (and other post types) analysed per batch. Lower it if a batch runs out of time or memory.
Analysis Buffer 100 1–500 Media entries or files checked against the references at a time.
File Operation Buffer 20 1–100 Media entries or files deleted at a time.
Uploads Folder File Buffer 500 10–1000 Files read at a time from each folder during an uploads folder scan.
References Buffer 500 10–1000 References written to the database at a time. Lower it on small servers with memory errors.
Document Limit (in bytes) 8388608 (8 MB) 1 MB or more, or -1 The largest single piece of content (HTML or stored data) that is analysed. Bigger ones are skipped and noted in the logs. -1 removes the limit.
Delay (in ms) 100 0–10000 Wait between requests. Use 2000 or more on slow or shared hosting.
Shortcodes (Disable Analysis) Off Stops shortcodes being resolved. Scans get faster, but anything rendered by a shortcode (galleries, sliders) becomes invisible and may be reported as unused.
Output Buffer Cleaning (Disable Cleaning) Off By default, Media Cleaner clears output that other plugins or themes add to its server responses. Turn cleaning off only if you are told to.

Logs & Debug

Setting What it does
Logs (Enable) Keeps a simple log of what each scan does. On by default. Needed for Scan Details on the dashboard and for useful support reports.
PHP Error Logs (Enable) Also writes the log lines to the PHP error log. Shown when Logs is on.

Support IDs lists every scan or cleanup that failed, with the date and error. Click Copy and send the Support ID to us with your message. View shows the details and Delete removes one.

License

Enter and activate your licence key here.

Common tasks

Find unused media in the Media Library

  1. Make a backup of your site.
  2. Go to Media > Cleaner.
  3. Choose Clean Library in the scan menu.
  4. Click Scan. Tick I have a recent backup of my site. in the Safety Checklist, then click I Understand.
  5. Wait for the scan to finish. You can click Resume Later and come back.
  6. Review the To Review tab. The Reason column says why each item is listed, for example Not found in content or File missing.

Find files in the uploads folder that are not in the library

Needs an active licence.

  1. Go to Media > Cleaner and choose Clean Uploads Folder.
  2. To scan one folder only, click Pick Folder.
  3. Click Scan.
  4. Items marked Not in library are files on disk with no Media Library entry. Retina copy without original and WebP copy without original are extra copies left behind after the original was removed.

Delete files safely

  1. Select the items in To Review, then click Delete (or Delete All for every result).
  2. The files move to the Media Cleaner trash, in a private folder outside your uploads. Nothing is erased yet.
  3. Check your site.
  4. If something is missing, open the Trash tab, select it and click Recover.
  5. When you are happy, click Empty Trash. This is permanent.

Note

After an update of Media Cleaner, or after an unfinished scan, cleanup waits for a fresh scan. The dashboard says Run a new scan to clean up. Your files and trash are not touched.

Keep a file that is reported as unused

  1. Select it in To Review.
  2. Click Ignore. It moves to the Ignored tab and is never deleted.
  3. To change your mind, open Ignored and click Stop Ignoring.

Find duplicate files

Needs an active licence.

  1. Choose Clean Duplicates (BETA) and click Scan.
  2. Click the count in the Inspect column to compare the identical copies.
  3. For each copy, choose Keep or Trash. Check where each copy is used first: identical does not mean unused.

Tidy thumbnails

Needs an active licence.

  1. Choose Optimize Thumbnails and click Scan. Media Cleaner creates thumbnails your site is missing and lists those made for sizes no longer in use (Unnecessary thumbnail).
  2. To remove thumbnails of a size you still have registered, click Select Sizes and tick that size under Remove.

See where a file is used

  • Open the References tab on the dashboard to see every place a scan found media.
  • Or open the media item's edit screen and look at the Media Cleaner box.

Export the results

Click Export Results on the dashboard to download the current results as a CSV file.

Clean up with an AI assistant

  1. Install OG AI Core and turn on its MCP module.
  2. In Media Cleaner, go to Advanced and enable MCP.
  3. Connect your assistant to OG AI Core's MCP server. The Media Cleaner tools are for administrators only.

The assistant is told what the scan can and cannot see. It moves files to the trash, not straight to deletion, and it can only delete permanently after you ask for it in so many words.

FAQ and troubleshooting

Is a file marked "Not found in content" safe to delete?

Not always. It means the scan found no reference to it. Builders without a parser, theme templates, custom code, CSS, JavaScript, external sites or another site sharing the uploads folder can still use it. Delete it, check your site, and recover it from the trash if needed.

A plugin is marked with a cross in Parsers

Its parser needs an active licence. Until then, media used only by that plugin can be reported as unused. Check those files by hand before deleting.

The scan stops or says my server took too long

Go to Advanced, set Delay (in ms) to 2000, or click Auto Buffer, then resume the scan. Lowering Posts Buffer also helps on slow servers.

A scan was interrupted

The dashboard offers Resume, or Start Over. Discard and Keep Previous Results throws away the interrupted scan and keeps your last finished results. Nothing is changed until a scan finishes.

Some files cannot be removed from the trash

Click Force Empty Trash when the dashboard offers it, or Force Clean Trash under Advanced. Only do this with a recent backup.

An item has a SAFE or CACHE label

SAFE means the reference is protected and will not be deleted. CACHE means a cached copy of the site refers to the file, so deleting it could break that cached copy.

I need to report a problem

Turn on Logs, repeat the scan, then copy the Support ID from Logs & Debug > Support IDs and send it to us.

Uninstalling

Deactivating the plugin keeps everything.

When you delete the plugin, what happens depends on Plugin Data:

  • Off (default): your settings, scan results and the trash folder stay.
  • On: Media Cleaner first checks its trash. If anything is still in it, the uninstall stops and asks you to recover or empty the trash, so no files are left stranded. If the trash is empty, it removes all its ogmc_ options, its temporary data and its database tables.

Tip

Empty or recover the trash before you uninstall, whichever setting you use.

For developers

Hooks, REST routes, MCP tools and WP-CLI commands are in the developer's guide.