Black Friday - Cyber Monday Sale
30% OFF All Premium Licenses
  • 00 Days
  • 00 Hrs
  • 00 Mins
  • 00 Secs
Use code
SIGMA30

This 30% discount applies only to the first year. From the second year, renewals are charged at the regular price.

What are WordPress revisions and how to clean them?

Younes JFR.

What are revisions?

Each time you update or save a post or a page, WordPress automatically creates a new revision to store the previous version of your content. These revisions allow you to restore older versions of your post when needed, but over time, they can accumulate in large numbers, especially on active websites with frequent content updates.

How they affect your database?

Each revision is stored as a separate entry in the wp_posts table. Having too many of them increases your database size and can slightly slow down operations such as post queries, database backups, or exports. On sites with thousands of posts, revisions can represent a significant amount of unnecessary data.

How to clean them?

1. Using Advanced Database Cleaner plugin

You can easily clean up old post revisions using the General Cleanup module in Advanced Database Cleaner plugin.

This method is safe, flexible, and fully automated. You can customize the cleanup to:

  • Delete all revisions or keep only recent ones (for example, keep revisions newer than X days).
  • Retain a specific number of revisions per post using the Keep Last feature.
  • Schedule automatic cleanups so that revisions are regularly deleted without manual intervention.

2. Using a raw SQL query

If you prefer a manual method, you can also run the following SQL query directly from phpMyAdmin for example:

DELETE FROM wp_posts WHERE post_type = 'revision';

In a multisite installation, this query must be executed separately for each subsite, replacing wp_ with the corresponding subsite table prefix (for example, wp_2_, wp_3_, etc.).

Note:
While you can manually run these SQL commands to clean revisions, we strongly recommend using the Advanced Database Cleaner plugin.
It uses WordPress’s internal cleaning methods, automatically handles multisite installations, and ensures that all related data is safely removed while keeping your database consistent and stable.