...
Struggling to get seen on Google? Grab your free SEO audit and find out exactly what’s holding you back. 🚀

This WordPress database Cleanup Trick : Delete WP Post Revisions

Delete Wordpress Post revisions

If you’ve ever tried exporting a bloated WordPress database, you’ll know the pain — timeout errors, PHP memory exhausted warnings, and a CSV file so heavy it might as well be a doorstop. But here’s the kicker: this isn’t a dev issue. It’s a workflow issue.

You build on live. You tweak pages. You A/B test headlines. You revise content on the fly.

It’s fast. It works. Until it doesn’t.

Table of Contents

Let’s talk Elementor and its messy side hustle

Here’s a real one: we audited a business homepage recently. Looked totally normal from the front. But behind the scenes? 1,374 post revisions. That’s 1,374 full versions of the page Elementor stored in your database history.

That’s not just untidy. That’s nuclear bloat.

And when WordPress starts buckling under that kind of load, backups fail, admin dashboards crawl, and migrations become a nightmare.

If you’ve ever screamed at a spinning export wheel for 20 minutes, this post is for you.

Why this happens (and why most WordPress users never notice)

Elementor (and most modern page builders) saves the entire page structure with every revision. Which means every tweak to a button, every new padding setting, every image re-alignment… it’s all getting logged.

Multiply that by every page, every post, and every contributor on your site, and you’re sitting on a data landfill.

What’s wild is how few site owners realise this is what’s tanking their performance.

Clean it up in one go: SQL command to delete all wp post revisions

This is the part where we help you clean house.

But before you run anything on your live site — always take a full backup. We can’t stress this enough. If you’re not sure how, grab a tool like UpdraftPlus or speak to your hosting provider.

Once you’ve done that, fire up phpMyAdmin, locate your database, and run the following query. Just replace "prefix" with your table prefix.

  DELETE a, b, c 
FROM meq_posts a 
LEFT JOIN meq_term_relationships b ON (a.ID = b.object_id) 
LEFT JOIN meq_postmeta c ON (a.ID = c.post_id) 
WHERE a.post_type = 'revision';
  

That’s it. This will wipe out every revision stored in your database — freeing up serious space and lifting some weight off your server.

After that, head to the Operations tab in phpMyAdmin and hit OPTIMIZE TABLE. It reclaims unused space and gives your DB a bit of spring cleaning.

Stop the madness: Limit future wordpress revisions

Next, futureproof your site.

Pop open wp-config.php and add this line near the top (somewhere above the “That’s all, stop editing!” note).

  define('WP_POST_REVISIONS', 5);  

This tells WordPress to keep only the 5 most recent revisions per post.

That’s enough to roll back mistakes. But not enough to derail your database. It’s a sweet spot — we’ve seen it work well for service businesses, ecommerce sites, and even larger content hubs.

Bonus tip: Use a plugin to keep things tidy going forward

If SQL makes you itchy, or you want a visual safety net, grab a plugin like:

They’ll let you purge revisions, transients, and overhead regularly — and you can even set automated cleanups.

Why this matters for SEO

Bloated databases slow everything down. Admin performance. Page loads. Backup jobs. Even crawler efficiency.

And let’s be honest — if Googlebot can’t get through your site fast, it’s going to bounce before it sees your latest updates.

Here at ClickCrafters, we’ve seen speed wins just from this one clean-up step. Clients come to us with 8-second page loads and leave with sub-2-second performance just from trimming the excess.

You don’t need a rebuild. You need a database diet.

Final thoughts

Most people think SEO is about keywords and backlinks. But it’s often the unsexy backend stuff — like this — that makes all the difference.

So if you’re running a WordPress site that’s been active for more than a year (especially if you’ve got Elementor or another page builder in play), do yourself a favour: check your revision count.

It might just be what’s holding your site back.

FAQs

Yes — revisions are just saved versions of content. Deleting them won’t affect your live pages. Just back up before you run the script.

Not at all. WordPress will just keep the most recent ones. It’s actually better for performance and storage.

Yes. Tools like WP-Optimize or Advanced Database Cleaner let you schedule cleanups weekly or monthly.

Check your wp-config.php file. Look for the line that says $table_prefix = 'xyz_'; — replace meq with your prefix in the SQL query.

Share This Post
Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore