WordPress creates a copy every time you save or revise a post. This leads to multiple copies of the post revisions being stored in the WordPress database.
In this post you will learn How to Disable WordPress Post Revisions, Limit WordPress Post Revisions and also to Delete old saved copies of post revisions that are already stored in your WordPress database.
Disable WordPress Post Revisions
In order to completely disable WordPress post revisions you need to follow these steps.
TEXT AD11. Login to cPanel
If you do not have access to cPanel, here is how you can edit the wp-config.php File: 2 Methods to Edit Wp-Config.php File
2. In cPanel, click on File Manager
3. Click on public_html > wp-config.php and then open the wp-config.php file.
4. Add the following code to the file and click on Save.
define(‘WP_POST_REVISIONS’, false);
This single line of code will disable all future post revisions and you will be never bothered with WordPress post revisions.
Limit WordPress Post Revisions
The WordPress Post revision feature is useful in case you make a mistake or accidentally lose your work while composing a post. If this happens, you can always go back to a previous revision and carry on from there.
For this reason, it is always a good idea to limit the number of post reasons, rather than completely getting rid of this feature.
You can limit the number of WordPress post revisions by following these steps
1. Once again open the wp-config.php file located in your WordPress root directory and add the single line of code below to the file.
TEXT AD2define(‘WP_POST_REVISIONS’, 3);
Again, this single line of code will limit the number of post revisions to 3 copies, you can also set this number to 2 or as many post revisions as you think is suitable for your website.
Tip: You can also use the Revision control plugin to limit or completely disable post revisions.
Delete WordPress Post Revisions from Database
Getting rid of WordPress post revisions or limiting them does not remove the old copies of post revisions that are already sitting in your database.
You can easily get rid of these unnecessary copies of your posts by following these steps.
1. Login to your cPanel
2. Click on phpMyAdmin Tab
3. Next Click on the SQL tab
4. Type in the following SQL Query in the Query box and click on the ‘Go’ button located at the bottom and to the right of the SQL Query box.
DELETE FROM wp_posts WHERE post_type = “revision”;
This simple SQL query will locate all the posts that are marked as revision by WordPress and delete them from the database, leaving you with a lighter database.
Important: It is crucial that you make a copy of your wordPress database before running this SQL query. This will save you from grief in case you accidentally delete or damage your WordPress database.
Tip: You can also use Wp-Optimize plugin to remove all the old post revisions stored in your database.