WordPress database and media library cleanup plugin. Removes accumulated junk (revisions, drafts, transients, orphaned metadata, spam), finds unused images and orphaned filesystem files, and optimises oversized images. Full dry run preview before anything is touched. Completely free.
No subscriptions. No external services. No calls home.
Full write up with screenshots: WordPress Space Cleanup: A Free WordPress Database and Media Library Cleanup Plugin
- Post Revisions older than configurable threshold (default 30 days)
- Draft Posts older than threshold (default 90 days)
- Trashed Posts older than threshold (default 30 days)
- Auto Drafts created when opening Add New Post and never saved (default 7 days)
- Expired Transients that WordPress never cleaned up
- Orphaned Post Meta referencing post IDs that no longer exist
- Orphaned User Meta left behind when users are deleted
- Spam Comments older than threshold (default 30 days)
- Trashed Comments older than threshold (default 30 days)
- Unused Images in your media library not found in any post content, featured images, widget settings, theme mods, site logo, or site icon
- Orphaned Filesystem Files on disk in
wp-content/uploadswith no corresponding WordPress attachment record
- Resize and recompress JPEG and PNG images exceeding configurable maximum dimensions or quality thresholds
- Destructive operation with explicit confirmation required
- Backup recommended before running
Always run a dry run first. The plugin scans your database and reports exactly what it found, with counts per category, individual post IDs, titles, and dates, without touching anything. Toggle states are respected so the dry run accurately reflects what the actual cleanup will do.
Cleanup operations use a three phase chunked engine: a start action builds the queue and stores it in a transient, a chunk action processes one batch (default 50 items) and updates the transient, and a finish action reports the final summary. The browser never waits more than a few seconds per request. Handles arbitrarily large datasets without PHP timeout issues.
Each category has an independent toggle. Green means included, grey means skipped. Toggle states are saved with Save Selection and respected at scan time. Categories you never want touched can be permanently disabled.
Every time based category has an age cutoff to prevent deleting recent items. Defaults are conservative. Adjust to match your workflow.
WordPress Cron based scheduler runs database cleanup automatically on selected days at a configured hour. For precise scheduling on low traffic sites, disable WP Cron and use a real system cron hitting wp-cron.php.
- WordPress 6.0 or higher
- PHP 8.0 or higher
- Download the latest release zip from the Releases page
- In WordPress admin go to Plugins > Add New > Upload Plugin
- Upload the zip file, click Install Now, then Activate Plugin
- Go to Tools > CloudScale Cleanup
Deactivate > Delete > Upload zip > Activate. If you have an opcode cache running (OPcache, Redis, WP Rocket, W3 Total Cache), deactivate and reactivate after installation to ensure new files are loaded cleanly.
Self contained: single PHP file plus two asset files (CSS and JS). No external dependencies, no calls home. Uses WordPress $wpdb for all database operations, respects WordPress nonces for AJAX security, hooks into the standard admin menu and enqueue system.
GPLv2 or later. See LICENSE for the full text.
Andrew Baker - CIO at Capitec Bank, South Africa.