Do you want to delete, disable or limit WordPress post revisions? Why?
- Your database is getting huge, and you don’t want extra stuff in your database.
- You have a limited database space.
WordPress Delete Revisions: Table of Contents
- wp-config.php Method
- Limit number of post revisions
- Remove WordPress post revisions from database
- Using a plugin
1. wp-config.php Method
Open wp-config.php and add the following line:
define('WP_POST_REVISIONS', false );
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:
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.
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.