WordPress Delete Revisions: Ways to Disable/Delete Post Revisions

Do you want to delete, disable or limit WordPress post revisions? Why?

  1. Your database is getting huge, and you don’t want extra stuff in your database.
  2. You have a limited database space.

WordPress Delete Revisions: Table of Contents

  1. wp-config.php Method
  2. Limit number of post revisions
  3. Remove WordPress post revisions from database
  4. Using a plugin

1. wp-config.php Method

Open wp-config.php and add the following line:

 define('WP_POST_REVISIONS', false );

Note: The code won’t delete current post revisions, but would stop future revisions to store in your database. For deleting the revisions completely, try database or plugin method below.

2. Limit number of post revisions

You can also limit the number of post revisions if you don’t want to disable the post or page revisions completely. Add the following code in wp-config.php:

 define('WP_POST_REVISIONS', 2);

Note: Now, there would be just 2 post/page revisions stored.

3. Remove WordPress post revisions from database

Visit phpMyAdmin and select the database from where you want to delete revisions.

WordPress delete revisions

Click on the “SQL” tab.

Paste the following SQL query into the text area and hit “Go” button:

 DELETE FROM wp_posts WHERE post_type = "revision";

4. Using a Plugin

I prefer to use “WP-Optimize” plugin because it has some extra features that I need to optimize my database other than deleting revisions. Download the plugin from here, install and activate it.

Click on “WP-Optimize” from the left-hand menu of your admin dashboard. Check the “Clean all post revisions” checkbox and hit the “Run Optimization” button.

I hope this tutorial will provide you all the answers to delete, disable or limit post or page revisions.

In this article

Join the Conversation