Title: Media Library Cleaner
Author: 1WL Agency
Published: <strong>July 22, 2024</strong>
Last modified: June 19, 2026

---

Search plugins

![](https://ps.w.org/unused-media-scanner/assets/banner-772x250.png?rev=3183744)

![](https://ps.w.org/unused-media-scanner/assets/icon-256x256.png?rev=3123020)

# Media Library Cleaner

 By [1WL Agency](https://profiles.wordpress.org/ts1wl/)

[Download](https://downloads.wordpress.org/plugin/unused-media-scanner.2.0.0.zip)

 * [Details](https://wordpress.org/plugins/unused-media-scanner/#description)
 * [Reviews](https://wordpress.org/plugins/unused-media-scanner/#reviews)
 *  [Installation](https://wordpress.org/plugins/unused-media-scanner/#installation)
 * [Development](https://wordpress.org/plugins/unused-media-scanner/#developers)

 [Support](https://wordpress.org/support/plugin/unused-media-scanner/)

## Description

Version 2.0 is a ground-up rebuild from the original release, with a new scanning
architecture and admin interface.

**How The Scanning Engine Works**
 Unlike lightweight scanners that only check the
post_content column, Media Library Cleaner performs a deep inspection across your
entire WordPress architecture. When a scan is initiated, every attachment in the
media library is checked against: **Core Content:** Standard post content and Gutenberg
block editor attributes. **Post Meta:** All custom fields and metadata, including
complex data structures generated by Layout & Design plugins like Elementor and 
Beaver Builder. **Theme Settings:** Theme mods, site icons, custom logos, and custom
header images. **Taxonomies & Users:** Term meta and user meta fields. **Widgets:**
Media widgets deployed across sidebars and footers. **Scan Options:** Administrators
can explicitly choose whether to include or ignore draft posts and post revisions
during the reference check. **Batched Processing Architecture** To handle enterprise-
scale WordPress installations, the scanning engine uses batched processing. Instead
of loading the entire database into memory, the plugin queries and processes content
in strict batches. This architecture prevents PHP memory exhaustion and server timeout
errors – and has been thoroughly stress-tested on environments containing over 60,000
posts.

A live four-phase progress bar tracks the execution in real-time, displaying counts
for:
 Initialisation Post scanning Metadata scanning Results loading Once the scan
completes, results are loaded into a split-view dashboard separating Unused Files
from Used Files. **Used Files View:** Explicitly lists the specific posts, pages,
or settings where an attachment is currently referenced, giving you absolute certainty
about why a file was flagged as active. **Progressive Card Grid:** Files are displayed
in a visual grid showing the image thumbnail (or a specific file type icon for non-
images), filename, file type, file size, exact pixel dimensions, and upload date.**
Sticky Selection Bar:** A persistent control bar tracks the total number of selected
files and calculates their combined file size in real-time, allowing you to see 
exactly how much server space you are about to reclaim. Includes bulk select/deselect
controls. **One-Click Selection:** Clicking anywhere on a progressive card toggles
a highly visible selected state (blue border and checkmark overlay). **Deletion 
Mechanics & Safety Protocols** Media Library Cleaner treats data destruction with
the utmost caution. A prominent backup warning is displayed before any scan or deletion
sequence can be initiated. **WordPress Capability Checks:** Before attempting to
remove any file, the plugin performs a strict, per-item capability check. Deletion
requests are automatically refused for any file the current user does not have explicit
permission to delete. **Confirmation & Permanence:** A WordPress-native confirmation
modal intercepts the deletion trigger, explicitly warning the user that deletions
are permanent (unless the MEDIA_TRASH constant is enabled in wp-config.php). **Batched
Deletion:** Much like the scanning process, file deletion is handled in batches 
with a live progress indicator. **Post-Deletion Reporting:** A completion modal 
provides a definitive summary, explicitly detailing how many files were successfully
deleted and how many failed. **Per-File Reporting:** Every individual file is reported
as a success or a failure, with specific technical reasons provided for any failed
deletions. **Persistent Logging & Environment Data** **Database Session Logs:** 
Every deletion run is permanently recorded in the database. This log records the
timestamp, the user who initiated the action, the total file count, and the explicit
success/failure results for every individual file processed during that run. **Environment
Info Tab:** A dedicated diagnostic tab provides administrators with critical context
before running a scan. It displays the total media count, the physical size of the
uploads folder, a list of all registered image sizes, the precise uploads directory
path, directory writability status, media trash status, and current PHP/WordPress
environment details. Installation Upload the media-library-cleaner folder to the/
wp-content/plugins/ directory. Activate the plugin through the ‘Plugins’ menu in
WordPress. Navigate to Tools – Media Library Cleaner in the WordPress admin menu.
Review the Environment Info tab and perform a full site backup. Configure your Draft
and Revision scan options, then click Run Scan. Frequently Asked Questions Will 
this plugin cause PHP memory errors on large sites? No. Media Library Cleaner utilizes
a batched scanning architecture that processes database queries in chunks. This 
prevents the server from loading massive datasets into memory simultaneously, preventing
timeout errors. It has been tested against databases with 60,000+ posts.

Does it support modern Layout & Design plugins?
 Yes. The metadata scanner explicitly
checks complex data arrays generated by Layout & Design builders such as Elementor
and Beaver Builder, ensuring assets embedded within builder modules are correctly
identified as “in use”.

Are deleted files recoverable?
 By default, WordPress permanently removes media 
files when deleted. Media Library Cleaner respects this core behaviour. However,
if you have defined define( ‘MEDIA_TRASH’, true ); in your wp-config.php file, deleted
files will be moved to the Media Library Trash rather than being permanently destroyed.

Why do some files fail to delete?
 The plugin enforces strict WordPress capability
checks on a per-item basis. If your user role lacks the required permissions to 
delete a specific attachment, or if the server directory lacks the necessary write
permissions, the deletion will be refused. The exact reason for the failure is recorded
in the persistent session log.

What information is stored in the persistent session log?
 The log records the timestamp
of the deletion run, the ID of the user who executed it, the total number of files
targeted, and a granular breakdown of which specific files succeeded or failed (
including the failure reason).

## Screenshots

[[

[[

## Installation

Just install/activate the plugin and it is ready to use in Tools > Media Library
Cleaner

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“Media Library Cleaner” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ 1WL Agency ](https://profiles.wordpress.org/ts1wl/)

[Translate “Media Library Cleaner” into your language.](https://translate.wordpress.org/projects/wp-plugins/unused-media-scanner)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/unused-media-scanner/),
check out the [SVN repository](https://plugins.svn.wordpress.org/unused-media-scanner/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/unused-media-scanner/)
by [RSS](https://plugins.trac.wordpress.org/log/unused-media-scanner/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 2.0.0

 * Complete UI rebuild using WordPress admin design patterns
 * Batched scanning architecture — eliminates memory/timeout errors on large sites
 * Persistent, searchable deletion log stored in the database
 * Per-file permission checks with detailed success/failure reporting
 * New Environment Info diagnostics tab

#### 1.0.11

 * Tested on WordPress 7

#### 1.0.10

 * Improved scanner

#### 1.0.9

 * Sanitize array fix

#### 1.0.8

 * Updated to support WordPress 6.9

#### 1.0.7

 * Update fix to tabs on media page
 * Rename title to be more descriptive

#### 1.0.6

 * Updated to support WordPress 6.6

#### 1.0.5

 * Further updates to comply with WordPress plugin guidelines

#### 1.0.4

 * Further updates to comply with WordPress plugin guidelines

#### 1.0.3

 * Further updates to comply with WordPress plugin guidelines

#### 1.0.2

 * Updates to comply with WordPress plugin guidelines

#### 1.0.1

 * Added localisation, in order to support additional languages in future. Currently
   just exists in English
 * Added a link to a Help page
 * Updated the design of the image results to feel more like the Media Library
 * Separated Unused Image Scanner results into individual tabs for Unused Images
   and Used Images

## Meta

 *  Version **2.0.0**
 *  Last updated **4 weeks ago**
 *  Active installations **30+**
 *  WordPress version ** 6.0 or higher **
 *  Tested up to **7.0.2**
 *  PHP version ** 8.0 or higher **
 * Tags
 * [clean uploads](https://wordpress.org/plugins/tags/clean-uploads/)[media cleaner](https://wordpress.org/plugins/tags/media-cleaner/)
   [media library](https://wordpress.org/plugins/tags/media-library/)[unused images](https://wordpress.org/plugins/tags/unused-images/)
 *  [Advanced View](https://wordpress.org/plugins/unused-media-scanner/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/unused-media-scanner/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/unused-media-scanner/reviews/)

## Contributors

 *   [ 1WL Agency ](https://profiles.wordpress.org/ts1wl/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/unused-media-scanner/)