Blog · Speed

WordPress Database Clean-up: What’s Safe to Delete (and What Isn’t)

Every WordPress database fills up with clutter: old revisions, expired temporary data, spam, and leftovers from plugins you removed years ago. Some of it slows your site down. But “database optimizer” plugins often delete more than they should. Here’s what is safe to remove, what to leave alone, and how to clean up without losing anything important.

Before anything else: make a full backup of your database. Every step below is safe in normal conditions, but a backup costs one minute and removes all risk.

Safe to delete

Old post revisions

WordPress saves a copy of a post every time you update it. A post edited 80 times has 80 copies. Deleting old revisions is safe, but keep the most recent few per post so you can still undo a recent mistake. To stop them piling up again, add this to wp-config.php:

define( 'WP_POST_REVISIONS', 10 );

Auto-drafts and trashed posts

Auto-drafts are created whenever you click “Add New”, even if you never write anything. WordPress removes old ones itself, but they can build up. Items in the trash are deleted after 30 days anyway, so emptying the trash early is safe once you’re sure.

Spam and trashed comments

Completely safe to delete. On sites with open comments there can be tens of thousands.

Expired transients

Transients are temporary cached data with an expiry date. Expired ones are useless, and deleting them is safe. Plugins recreate whatever they still need. Deleting all transients, including unexpired ones, is also safe, but may make the next few page loads slower while caches rebuild.

Table overhead

After lots of deletions, database tables keep unused space (“overhead”). Optimizing them reclaims it. It’s safe, but on very large tables run it at a quiet time, because the table is briefly locked.

The hidden speed killer: autoloaded options

The wp_options table holds settings, and many are marked to autoload, meaning WordPress loads them into memory on every page view. When plugins store large amounts of data this way, or leave it behind after you uninstall them, every request gets slower. WordPress’s Site Health warns when autoloaded options pass 800 KB.

Handle with care. Don’t bulk-delete options. Instead:

  1. Find the largest autoloaded options.
  2. Check their names. Most start with the plugin’s name or prefix.
  3. If they belong to a plugin you’ve deleted, they can usually go. If they belong to an active plugin, leave them and look for a setting in that plugin (logs and statistics are common culprits).

Leave these alone

  • “Orphaned” post meta and term data, unless you know what created it. Some plugins rely on data that looks orphaned.
  • Tables from plugins you still use, even if they look big. WooCommerce and form plugins store real orders and entries.
  • WooCommerce sessions and orders, unless you use WooCommerce’s own tools under WooCommerce → Status → Tools.
  • Anything in wp_users or wp_usermeta, unless you’re removing users through the WordPress admin.
  • Pending comments: they may be real comments waiting for your approval.

How often?

For most sites a light clean-up once a week or once a month is plenty: revisions, auto-drafts, spam, expired transients and table overhead. Check the autoloaded options every few months, and after you uninstall big plugins.

One click, nothing risky: the free Fixwise plugin shows exactly how much clutter your database has and cleans only the safe items above: old revisions (it keeps recent ones), auto-drafts, spam, expired transients and table overhead. It also lists your biggest autoloaded options so you can decide what to do with them. Switch on the optional weekly clean-up and forget about it. More speed tips: why is my WordPress site slow?

See your site's score in about a minute.

Install the free plugin and click Scan. Nothing changes until you say so.

Download Fixwise free