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

ItemDescriptionRisk
RevisionsPost revision historySafe
Auto-DraftsAutomatic save draftsSafe
Trashed PostsPosts in trashSafe
Orphaned Post MetaMeta for deleted postsSafe

Comments

ItemDescriptionRisk
Spam CommentsComments marked as spamSafe
Trashed CommentsComments in trashSafe
Unapproved CommentsPending moderationCaution
Orphaned Comment MetaMeta for deleted commentsSafe

Transients

ItemDescriptionRisk
Expired TransientsTransients past expirationSafe
All TransientsEvery transient in databaseCaution

Other

ItemDescriptionRisk
Orphaned Term RelationshipsBroken taxonomy linksSafe
Orphaned User MetaMeta for deleted usersSafe
Duplicated Post MetaIdentical meta entriesSafe

Preview Before Cleaning

Before any cleanup operation, you can preview exactly what will be deleted:

  1. Click the item count number
  2. See a list of items that will be removed
  3. Review to ensure nothing important is included
  4. Proceed with cleanup or cancel

Running Cleanup

Manual Cleanup

  1. Check the items you want to clean
  2. Click Clean Selected
  3. Confirm the operation
  4. View results showing items removed

Scheduled Cleanup

Set up automatic cleanup:

  1. Go to the Settings tab
  2. Enable scheduled cleanup
  3. Choose frequency: Daily, Weekly, or Monthly
  4. Select which items to clean automatically
  5. Cleanup runs via WordPress cron

Table Browser

The Tables tab shows all database tables with:

ColumnDescription
Table NameDatabase table name
RowsNumber of records
SizeData size on disk
OverheadFragmentation/wasted space
ActionsOptimize 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.

PRO

Get access to all 166 modules with a single license

Upgrade to Pro