How to limit number of revisions in WordPress.

WordPress comes with a feature called Revisions that creates a copy of the old version of the post that you have updated.

This feature could be really a life saver if something goes wrong. You can easily revert back to the old version.

But this features becomes a headache when you update a post for just a simple comma or a full stop and WordPress stores it. If you have a lot of post then this could pile up a lot and may cause degradation of performance.

Believe me when I say for faster WordPress website you have to keep everything clean else you will be always worried about the speed.

See you won’t require that much revisions just last 3 and max to max last 5 will be sufficient for you. So how to limit them let’s see.

This is the process for older websites please skip this section if you have a newer one.

Deleting older revisions.

If you haven’t limited your WordPress revisions there is high chances that you might have a hundreds or even thousands of revisions.

So get rid of this you need to delete them. Let’s see how to do that.

Step 1: Installing WP Sweep plugin.

Install the free WP Sweep plugin. What this plugin does is that it will help you to delete the older revisions.

Step 2:

Head over to tools then click on sweep.

The you will see many options like Revisions,Auto draft, Deleted Post and many more.

Step 3 :

You will see sweep option in front of revisions. Click on sweep.

You are done cleaning your old revisions.

Now it’s time to limit revision so it do not pile up like before.

Limit Number of WordPress Revisions.

As mentioned earlier limiting limiting revisions will be time saver for your in future if you have large number of post.

Step 1:

You need to add a line of code in wp-config.php. To access this file you need to access this file via FTP. (You will find this file in main repository).

Warning: Before editing make sure you have a create a backup of wp-config.php files so that if anything goes wrong you can revert back to any time.

Step 2:

Insert this piece of code above ABSPATH or where you see “That’s all, stop editing.”

define('WP_POST_REVISIONS', 5);

Change the above number to your choice. Anything from 3-5 is always recommend.

The code should look something like this.

Conclusion

So this is the way you can clean your earlier revisions and limit the number of revisions in WordPress and prevent it from forming huge load in your database.

Leave a Comment