SHARE THIS ARTICLE:

how-to-disable-post-revisions-and-remove-old-posts-in-wordpress

If you are WordPress user then you can see post revisions option on the right side of post / page editing area. Post revision is WordPress’s default feature and it can automatically save every post when you hit the save button. Even it may happen when you revise or edit the post or correct one or few words. Every time it makes a copy of that post in the WordPress database. As a result, you will get lots of copies of your original post in the database.

copies-of-revisions-in-post-editing-area

Normally post revisions don’t affect website loading time or website performance. It just reduces the database spaces. If you have limited hosting space for your website or blog then it is an important issue for you. If you don’t control old post revision then the old posts will reduce your WordPress hosting database. To solve limited database space problem here I am going to share how to disable or limit post revisions in WordPress.

Limit WordPress Post/Page Revisions

By default, WordPress has no limit for post revisions. You can set a limit for post revisions. Here I have set post revisions limit maximum to 3. That’s mean in total there will be four (4) posts. One (1) original post and three (3) revision posts. The older ones are automatically deleted once newer versions are saved. You can change the limit as your wish. Follow below steps to limit your WordPress’s post revisions.

#Login to your cPanel.
#Go to cPanel File Manager Code Editor and navigate to wp-config.php file.
#Now copy paste below code towards the top of the wp-config.php file and hit the save changes button.

define('WP_POST_REVISIONS', 3);

Now you are done.

Disable WordPress Post/Page Revisions

You can also disable all future WordPress revisions. That’s mean through below code you can totally disable the revision function. If you have enough database space then just limit the revision number. WordPress autosave helps during unexpected situation just like browser crash, computer crash etc. So it’s not a wise decision to completely disable the post revisions. But if you have limited database space then follow below steps to disable WordPress post revisions.

#Login to your cPanel.
#Go to cPanel File Manager Code Editor and navigate to wp-config.php file.
#Now copy paste below code towards the top of the wp-config.php file and hit the save changes button.

define('WP_POST_REVISIONS', false);

Now you are done.

Now if you want to reenable WordPress post revision then just replace below code with the above one.

define( ‘WP_POST_REVISIONS’, true );
Set Auto Save Interval For WordPress Revisions

By default WordPress automatically saves the post every minute (60 seconds). You can change the autosave interval to ten (10) minutes (600 seconds) to reduce post revisions. Follow below steps to set custom auto save interval.

#Login to your cPanel.
#Go to cPanel File Manager Code Editor and navigate to wp-config.php file.
#Now copy paste below code towards the top of the wp-config.php file and hit the save changes button.

define( ‘AUTOSAVE_INTERVAL’, 600 );

Now you are done.

Now How To Remove The Old Saved Posts

Once you limit or disable the post revisions then you need to delete the old ones. You can do this by two methods. First one is SQL query and the second one is by using WordPress Plugin.

Remove All Old Posts By SQL query

To run an SQL query is a very easy process. It is very important to create a backup of your WordPress database before running the SQL query. A backup will protect your site during an unexpected situation. Now follow below steps to run SQL query.

#Login to your cPanel and navigate to PHPMyAdmin
#Now run the following SQL query

DELETE FROM wp_posts WHERE post_type = "revision";
Remove All Old Posts By Using Plugin

There are lots of plugins for deleting old posts. In this article, I have used Better Delete Revision WordPress Plugin. This plugin is easy to use. Go to Plugins » Installed Plugins » Add New » Search Better Delete Revision » Then install and activate the plugin.

Now How To Delete Old Posts

Go to Setting » Better Delete Revision » Check Revision Posts. Now you will get a list of total revision posts of your site. Now click Yes, I would like to delete them!

check-revision-posts-through-better-delete-revision-wordpress-plugin

delete-revision-posts-through-better-delete-revision-wordpress-plugin

Now your task is done.