WordPress database cleanup is a bit like tidying the storage room behind a shop. Every day a little more gets stacked in there: old paperwork, boxes you meant to throw out, things a supplier dropped off and never picked up. Nobody notices for a while. Then one day it's hard to find anything, and everything takes longer.

Your WordPress site works the same way. Over months and years, the database quietly fills with stuff you don't need: old copies of posts, leftover data from plugins, and background tasks that failed and were never cleared. You can't see any of it from the front of your site, but it makes every page a little slower to load and every backup a little bigger.

Cleaning it up just means tidying that storage room, throwing out the junk while keeping everything that matters. This guide explains, in plain terms, what's safe to remove, what you should never touch, and how to let a tool handle the boring parts for you.

Why your database fills up in the first place

WordPress is cautious by design. It saves extra copies of things "just in case," and it almost never deletes them on its own. That's good when you need to undo a mistake, but it means clutter builds up forever unless something clears it.

Here are the four most common things filling up your database:

  • Post revisions. Every time you save a post or page, WordPress keeps the old version. Edit one page 30 times, and you've got 30 saved copies of it sitting in the database. Only the latest one is actually shown on your site.

  • Expired transients. "Transient" is just WordPress's word for temporary saved data — like a sticky note that was only meant to last an hour. When it expires, the note usually stays stuck to the wall instead of getting thrown away.

  • Failed background jobs. WordPress and plugins (especially WooCommerce) run background tasks — sending emails, syncing orders, and so on. When one of those tasks fails, it leaves a record behind. Those records pile up.

  • The debug log. If your site is set up to record errors for troubleshooting, it writes them to a file called debug.log. That file keeps growing and is very easy to forget about.

None of these is a disaster on its own. But add them up across a site that's been running a couple of years, and you get a database that's slower and heavier than it needs to be.

What's safe to delete (and what to leave alone)

This is the most important part, so here's the simple version.

Safe to clean out:

  • Old post revisions — your live, published pages are never revisions, so deleting old copies never removes real content.

  • Expired transients — these are just expired sticky notes. Throwing them away is exactly what's supposed to happen.

  • Failed background jobs older than a month — if a task failed 30 days ago, it's not going to suddenly work now.

  • The contents of the debug log — it's a notepad for errors, not part of your actual site.

Leave alone unless you really know what it is:

  • Leftover bits of data from plugins you don't recognize.

  • "Orphaned" data that looks unused — sometimes a plugin still needs it.

  • Trashed posts or drafts you haven't looked through yet.

The easy rule to remember: temporary stuff and error logs are always safe to clear. Anything that might be real content, or that a plugin might still be using, is not — so when in doubt, leave it.

The one step you must never skip

Before you delete anything from a database, make a backup. Always.

A backup is a saved copy of your whole database. If something goes wrong, you restore the copy, and you're back to where you started. It takes two minutes, and it's the difference between "oops" and a disaster. Most hosting dashboards and backup plugins can make one with a single click. Do that first, every time.

How a WordPress database cleanup tool does this for you

You can clean a database by hand, but it means writing database commands, knowing which WooCommerce tables are safe to touch, and hoping the job doesn't time out halfway through on cheaper hosting. For most people, that's more risk than it's worth.

This is what the latest BoltAudit update (version 0.3.0) is built to handle. It adds one-click cleanup for exactly the safe items above:

  • Delete old post revisions — clears out those extra saved copies of your posts and pages.

  • Clear failed WooCommerce / background jobs — removes failed tasks older than 30 days, along with their leftover logs.

  • Empty the debug log — wipes the error notepad clean without breaking anything.

Here's why it's safe to run, even on a busy store:

  • It won't crash on slower hosting. Instead of trying to delete everything at once (which can freeze and fail on cheap hosting), it works in small batches and stops itself before it runs out of time. If there's more to clean, you just click Continue, and it picks up where it left off.

  • It double-checks its own work. After cleaning, it confirms the junk is actually gone before telling you it succeeded — so you never get a false "all done."

  • It can't touch the wrong files. The debug-log cleaner is locked to your WordPress folder, so it can't accidentally wipe something it shouldn't.

  • It checks before it acts. For WooCommerce cleanup, it ensures the correct tables exist first. If something looks off, it simply does nothing instead of causing an error.

Because these cleanups permanently remove data, BoltAudit shows you exactly what's about to happen and reminds you to back up first — so you're always in control.

How often should you do this?

For most sites, a cleanup every few months is plenty. If you run a busy WooCommerce store with lots of orders, once a month is a better habit, because failed background jobs accumulate fastest in stores.

Even better than cleaning often is preventing the mess. A quick tip: you can tell WordPress to keep only a few revisions per post by adding one line to your site's wp-config.php file:

php

define( 'WP_POST_REVISIONS', 5 );

That keeps the last 5 versions of each post and stops the rest from ever piling up.

The simplest way to start: install BoltAudit from the WordPress.org plugin directory, then open Tools → BoltAudit and run a free Local Audit. It shows you which parts of your database are actually bloated, so you only clean where it's needed — and you can see the difference afterward.

Run BoltAudit on your site

Free plugin · 1 site · 3 audits per month · no credit card.

See plans →