How to disable and remove WordPress post revisions

By default, WordPress stores revisions for all your posts when you draft or update them. It’s a useful feature when you want to go back to previous versions of your posts and/or restore them. However, you may not really care about revisions and if you run a WordPress site long enough, these revisions will accumulate, unnecessarily bloating the wp_posts table and taking up space in the database. Luckily there is a simple way to limit or disable the revisions altogether and remove those that are already stored in the database.


  1. Change the WordPress revision behavior
    • To disable, add define('WP_POST_REVISIONS', false); to your wp-config.php file.
    • To limit the revisions, add define('WP_POST_REVISIONS', <max revisions>); to your wp-config.php file, where <max revisions> is the number of maximum revisions that you would like to keep per post.
  2. Connect to the WordPress database and run DELETE FROM wp_posts WHERE post_type='revision';

Disable post revisions

To disable post revisions, you have to set the WP_POST_REVISIONS parameter to false, which you can do by adding the following instruction into your wp-config.php file:

define('WP_POST_REVISIONS', false);

Limit post revisions

If you rather want to limit the number of revisions that WordPress stores, you can specify the maximum number instead of false. For example, to only allow a maximum of 3 (+1 autosave), specify:

define('WP_POST_REVISIONS', 3);

Remove post revisions

Post revisions are stored as separate entries in wp_posts with the column post_type='revision'. To clean them up, simply execute the following statement in the database:

DELETE FROM wp_posts WHERE post_type='revision';

Once your statement has finished, you have successfully removed old WordPress post revisions.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.