Database Cleaner
WordPress databases accumulate clutter over time — post revisions, spam comments, orphaned metadata, expired transients. This module provides comprehensive cleanup tools with detailed analysis, safe previews, and scheduled automatic maintenance.
This module is in beta. Always backup your database before running cleanup operations.
Use Cases
- Remove thousands of post revisions eating up database space
- Clean spam comments and trashed content
- Optimize database tables for better query performance
- Schedule automatic cleanup to keep database lean
- Browse and analyze database contents
Accessing Database Cleaner
Navigate to Switchboard → Database Cleaner in the admin menu. The dashboard shows:
- Current database size
- Cleanup categories with item counts
- Table browser and optimizer
- Options and metadata explorers
- Cleanup logs
Cleanup Categories
Posts
| Item | Description | Risk |
|---|---|---|
| Revisions | Post revision history | Safe |
| Auto-Drafts | Automatic save drafts | Safe |
| Trashed Posts | Posts in trash | Safe |
| Orphaned Post Meta | Meta for deleted posts | Safe |
Comments
| Item | Description | Risk |
|---|---|---|
| Spam Comments | Comments marked as spam | Safe |
| Trashed Comments | Comments in trash | Safe |
| Unapproved Comments | Pending moderation | Caution |
| Orphaned Comment Meta | Meta for deleted comments | Safe |
Transients
| Item | Description | Risk |
|---|---|---|
| Expired Transients | Transients past expiration | Safe |
| All Transients | Every transient in database | Caution |
Other
| Item | Description | Risk |
|---|---|---|
| Orphaned Term Relationships | Broken taxonomy links | Safe |
| Orphaned User Meta | Meta for deleted users | Safe |
| Duplicated Post Meta | Identical meta entries | Safe |
Preview Before Cleaning
Before any cleanup operation, you can preview exactly what will be deleted:
- Click the item count number
- See a list of items that will be removed
- Review to ensure nothing important is included
- Proceed with cleanup or cancel
Running Cleanup
Manual Cleanup
- Check the items you want to clean
- Click Clean Selected
- Confirm the operation
- View results showing items removed
Scheduled Cleanup
Set up automatic cleanup:
- Go to the Settings tab
- Enable scheduled cleanup
- Choose frequency: Daily, Weekly, or Monthly
- Select which items to clean automatically
- Cleanup runs via WordPress cron
Table Browser
The Tables tab shows all database tables with:
| Column | Description |
|---|---|
| Table Name | Database table name |
| Rows | Number of records |
| Size | Data size on disk |
| Overhead | Fragmentation/wasted space |
| Actions | Optimize button |
Optimizing Tables
Tables become fragmented over time. Optimization:
- Reclaims overhead space
- Reorganizes data for faster queries
- May briefly lock the table during operation
Click Optimize on individual tables or Optimize All for the entire database.
Options Browser
The Options tab lets you explore the wp_options table:
- Search for specific options
- View option values
- Delete orphaned or unnecessary options
- Identify large serialized options
Deleting options can break plugins or themes. Only delete options you understand.
Metadata Browser
Browse and clean post meta, user meta, and term meta:
- Search by meta key
- View meta values
- Delete orphaned entries
- Identify plugins leaving data behind
Cleanup Logs
The Logs tab shows history of cleanup operations:
- Date and time
- Items cleaned per category
- Total items removed
- Space reclaimed
FAQ
Will cleaning revisions break undo?
Yes, you lose the ability to restore previous versions of posts. If you need revision history, skip this item or keep recent revisions only.Is it safe to delete all transients?
Expired transients are always safe. Deleting all transients is generally safe — they’ll be regenerated — but may cause temporary slowdowns as caches rebuild.How much space will I save?
Depends on your site. Sites with years of content might recover hundreds of megabytes. New sites see less benefit.Should I optimize tables regularly?
Monthly is usually sufficient. Over-optimizing provides no benefit. The module shows overhead percentage to help you decide.Can I undo a cleanup?
No. Cleanup operations permanently delete data. Always backup before major cleanups.Start with a manual cleanup to see how much clutter you have. Then enable scheduled cleanup to maintain a lean database automatically.
Get access to all 166 modules with a single license