How to Limit Number of WordPress Revisions


In one of my previous posts, I wrote how to disable WordPress Revisions. In that article, I also wrote about the importance of revisions. Revisions help a lot in recovering the post content if you did some wrong changes and saved it. So, I don’t recommend you disable WordPress Revisions. If you are worried about the storage and performance of your blog, you can limit the WordPress revision.

Yes, WordPress also allows you to set the number of maximum revisions you want in your WordPress blog. In this way, you will not be disabling the revisions but limiting them to keep storage optimized. In this article, I will write steps to limit the number of WordPress revisions.

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider

Limit Number of WordPress Revisions

Like other tasks, you can either limit WordPress revisions using code if you know how to edit files or just install a plugin to do it easier. In this article, I will tell you both ways. If you do not want to install any plugin, you can use the second method where you will have to add a code in a WordPress file.

How to Limit Number of WordPress Revisions Using WordPress Plugin

If you want the easier way, you can just install a plugin that will do this job for you.

There is a plugin called WP Revisions Control. It lets you limit WordPress revisions. After you have installed and enabled this plugin, it adds a setting page where you can set the number of revisions you want to set. Go to Settings > Writing to specify the number of revisions for each post type.

Limit Number of WordPress Revisions Using WordPress Plugin

After saving this setting, it will keep the number of revisions of a post as per the value to add. I recommend people to have 3 revisions enabled. Having more than 3 will add extra overhead to the database for no valuable reason.

How to Limit Number of WordPress Revisions Using Code

It requires access to WordPress files. You can either use cPanel’s file manager, FTP, or any other panel you have installed on your hosting to manage your hosting and files.

Step 1: Access the root of your WordPress site directory. You can do it using the file manager of hosting software or FTP.

Step 2: Open the wp-config.php file in edit mode. I recommend you first download this file to avoid any issues if you made the wrong changes.

Step 3: Add the code given below and save the file. Add it above the ‘ABSPATH’ otherwise, it won’t work. The below code is for 3 revisions. You can change this number as per your interest.

define('WP_POST_REVISIONS', 3);

This code will only save three revisions. If you don’t set this limit, WordPress will keep saving a lot of revisions over time.

WordPress keeps autosaving your article in the form of revision. If you want, you can also change the autosave interval. Just add the following code in the same file.

define('AUTOSAVE_INTERVAL', 300); // seconds

In case your WordPress website stops opening and you see a white page of the PHP error page, you may have done something wrong. You can reupload the original file you downloaded before editing.

Final Words

WordPress revisions help a lot but having too many revisions makes the database large and ultimately affects the load time. If you have thousands of posts, you will see a considerable effect of a large number of revisions. So, limiting the number of WordPress revisions will surely help you a lot.


Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.

Similar Articles


Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker