Before starting this blog let me tell you, Post divisions are not bulky in size and it will not take up big storage to slow your hosting.
If you are someone who have large number of articles in your kitty. Then definitely you can free a big amount of storage in your database. Removing old post revisions can be beneficial for you. Yes I will help you on how to delete old post revisions in wp, WordPress for you in a much simple and efficient way.
How to enable and disable post revisions in WordPress blog
You simply have to add the code which is given below in the wp config file. Which you can find in root directory this will disable post revisions for your blog.
define( ‘WP_POST_REVISIONS’, false );
Somehow if you need to re – enable this feature in your blog then simply you have to change the code with this new line
define( ‘WP_POST_REVISIONS’, true );
You can notice this there is difference of only these two words false and true. You can reshuffle this false to true vice versa.
How to limit post revisions in WordPress
If you want to limit the number of post revisions to be saved in your WordPress database, Sometimes it will be handy in case if you break your site. According to us this is the best option which can be done regarding the post revisions in your blog.
You can add the code to limit post revisions to your blog which is given below to your wpconfig file.
define( ‘WP_POST_REVISIONS’, 3 );
You can change the number in the code according to your wish and demands. By adding this code only latest number (which is specified in the code you can change that too) will be saved older post gets deleted by itself
How to set autosave interval for posts in WordPress
As we have already gone through. We can limit the number of post revisions. But if you are someone who don’t want to do like that. Then instead of doing that we can increase the autosave time. This will help to save less number of post revisions. As you can simply increase the time interval this can be done by editing WP config file and adding the code which is given below.
define( ‘AUTOSAVE_INTERVAL’, 600 );
You can see we have changed the time from the default values provided by wordpress. To set autosave interval for posts. This way less number of post will be stored in the database and you will end up saving a lot of storage and this will help you to increase the speed of your blog as well. Do i need to mention benefits..
If you really don’t want to change the setting by placing the code in your WP config file. And maybe you are fearing to explore the coding side then there are other simple ways to do the same. one of them is installing a wordpress plugin like WP sweep and WP revisions control and WP optimize
How to remove older post revisions from wordpress blog
We have already disabled the post revisions but this will be effective for the new post we will be writing on our blog but what about the already saved post revisions to our database. Not an issue we will clean that too. There are two ways by which we can remove older post revisions from our website..
If you are fine with SQL queries then you can follow the steps. Which I have written in the method number 1 If you don’t want to involve yourself in nitty-gritties of codes. Then you simply jump up to the second method which is simpler indeed
Deleting post revisions with the help of code
We will recommend this method to our visitors as this will save us space which will be taken by plugin instead.
Use the SQL query and which is given below to delete older posts revisions from your blogs database in PHPmyadmin I will ask you to take a backup of your blog before running this SQL query in case you break your site.
DELETE from wp_posts WHERE post_type = “revision”;
This SQL query will remove all the post from your blogs database that have post_type =”revision”
Deleting post revisions using plugin in WordPres
There are plugins which can easily delete post revisions from your database. Here described plugins will come handy for you because of it’s simplicity.
Revision control – This plugin works out of the box you can configure this plugin with option to enable or disable post revisions in a very simple way. You can limit the number of post revisions too according to your wish with the help of this plugin.
Better delete revision plugin – This plugin will delete old post revisions from your blogs database. Along with this this, plugin will help you to remove metadata of those revisions and help you to optimise as well.
WP optimize plugin – This is one of the widely used plugins as with deleting all the previous post revisions. This will help you to optimize your blog too
What is the best way you liked for disabling removing post revisions from your database. Is there any other way you want us to know let us know through comments.