
WordPress Revisions is a great feature, offered by WordPress to revert back to your previous version of your content. Whenever you publish or update a blog post/page, it creates a revision in the database. You can use these revisions to revert back to your previous written content. However, it can hurt your WordPress site speed.
If you have a larger WordPress site, it can create a big problem for you. Because on larger WordPress sites, these post revisions can add up quickly to thousands of rows in your WordPress database which is not good for our site performance.
This can easily increase your WordPress database size and decrease the performance of your site. In this tutorial, I’m going to show you how to delete, limit and disable WordPress post revisions.
How to Optimize WordPress revisions
If you have an older WordPress site, you will see a lot of post revisions in your database because of years of editing and updating content. A large site like Mashable could have more than 200000+ revisions in the database. It adds up very quickly in the database. But don’t worry, there are couple of ways to optimize WordPress revisions. Once you optimize the WordPress post revisions, it will not hurt the performance of your site.
Table Of Contents
1. Delete WordPress Post Revisions
2. Limit WordPress Post Revisions
3. Disable WordPress Post Revisions
Delete WordPress Post Revisions
This step is not for new site users. If you have a new site, you can skip this step as your site won’t have existing WordPress revisions. If you have an older WordPress site, you need to first clean your database. When you free up space in your database, it will increase the speed of your site. I suggest you to not to use MySQL way to clean your database because there are a lot of bad snippets of code available on the internet forums and sites with false information.
I recommend using a plugin to delete WordPress post revisions. You can use Optimize Database after Deleting Revisions plugin which is No.1 in our plugin list. This plugin uses the WordPress built-in term functions which is the correct way to delete post revisions.
Step 1: Download and install Optimize Database after Deleting Revisions plugin. This plugin is free and having 90000+ active installations.
Step 2: Go to Optimize Database under Settings Tab and enable the “Delete revisions older than” option. Now input the date of the time for which you want to delete WordPress revisions.
Step 3: Now scroll down and select “check all tables”. It will exclude them from being optimized. After this, click on “Go To Optimizer” button.
Step 4: When you are done, Click on Start Optimization.
That’s it. Now you are done. After this, you will see the result of this optimization. I would recommend that you uninstall this plugin after deleting WordPress post revisions. Let’s go to the next step of WordPress Post Revisions Optimization.
Limit WordPress Post Revisions
After cleanup, I recommend you to limit the number of WordPress post revisions. We don’t need more than 3-5 post revisions. If you set the limit of revisions (For example 3), WordPress will keep that number and delete the previous revisions.
Typically this method is the most commonly used by WordPress users. Even I’m using this method on WPFuture because revisions are helpful to access the previous version of content. I like to keep 2-3 post revisions instead of 100-1000 revisions.
Step 1: Open the wp-config.php file from the root of your WordPress site directory and add some code to it.
Step 2: Paste the below code to your wp-config.php file. The code should be inserted above the “ABSPATH” otherwise it won’t work. You can also change the number of revisions you want to keep stored in your database. Just replace the “3” with your preferred number.
define('WP_POST_REVISIONS', 3);
Here is the screenshot for quick understanding.
Disable WordPress Post Revisions
If you are a single author on your site and want to get rid of WordPress revisions, follow this step to disable WordPress post revisions permanently.
Step 1: Open your wp-config.php file from the root of your WordPress site directory.
Step 2: Copy the below code and paste it in the wp-config.php file. The code should be inserted above the “ABSPATH” otherwise it won’t work.
define('WP_POST_REVISIONS', false);
Below is the screenshot for quick understanding.
Alternatively, you can use a free plugin called Disable Post Revision. Download and install it from the WordPress repository. Upon activation, go to Settings»Writing and select the post types for which you want to disable post revisions.
I hope you like this tutorial. Now don’t forget to share it on Facebook, Twitter and Google+.
Leave a Reply