Try any GetResponse Plan for free. No credit card required

How to limit or disable WordPress post revisions

Is your WordPress site slow even after installing and activating a well optimized lightweight WordPress theme combined with a good caching plugin? There must be a problem with your database. Yes, you heard me right. Most of the WordPress site owners forget to optimize their site’s database often. Some of them aren’t even sure if their site is using a database. But the fact is, if you are using WordPress, you are definitely making use of one database or the other. The most commonly used databases for WordPress are MYSQL and MariaDB.

WordPress currently supports MySQL 5.6 or above and MariaDB 10.0 or above.

Problem with WordPress revisions

Optimizing your WordPress site’s database often can help you improve your site’s performance in the long run. Whenever you are writing a post and, your WordPress editor will save a draft automatically. There may be other times when you manually hit the ‘Save Draft’ button to save the work you have done to your database. All these post revisions are stored in your WordPress database and having too many revisions in your database can slow your website down.

In this post, we’ll see how to limit or disable WordPress post revisions without using any plugins.

large number of post revisions in WordPress

How to disable WordPress post revisions

You don’t need any special WordPress plugin to disable post revisions in WordPress. All you need to do is add a few lines of code to your wp-config.php file and you’re all set. wp-config.php is one of the most important files in your WordPress installation and it is located in the root of your WordPress file directory. It contains your website’s base configuration details, such as database connection information.

You can access and edit your wp-config.php file by using any of the below methods –

Using FTP client

If you are old fashioned, you can open an FTP connection to your WordPress site using your favorite FTP client to list all your files for making changes. If you don’t have any specific FTP client in mind, I suggest you go with FileZilla, a free and open source software which is robust and reliable.

Using the cPanel file manager

If you have got access to your website’s hosting control panel (cPanel), you can make use of the file manager available over there to list your website’s files.

Using a WordPress plugin

To make things easier for WordPress users who haven’t got much experience working with their site’s technical aspects to understand this post, I’ll go forward with the third option of using a WordPress plugin to make changes to your wp-config.php file.

Disable WordPress revisions using WordPress Plugin

Step 1 – Install and activate the WP File Manager WordPress plugin from your WordPress dashboard.

install and activate WP file manager plugin

Step 2 – Click on the new WP File Manager option added under your settings menu on the left panel.

WP File Manager settings

Step 3 – By default, the plugin will display all the contents which are available under your public_html directory. The public_html folder is where we have installed WordPress and is the web root for your primary domain name.

wp-config.php file

Step 4 – Select for the wp-config.php file and right-click on it to display the available options. For there, click on Code Editor from the list.

open wp-config.php using code editor

Step 5 – The file will now be opened with a default notepad code editor. But before you make changes by following the next instruction, I suggest you go back to the previous step and download a copy of your wp-config.php file.

wp-config

Step 6 – Now, look for the line which says “/* That’s all, stop editing! Happy blogging. */”.

That's all, stop editing! Happy publishing.

Step 7 – Now copy the below code and paste it just above the line that says “/* That’s all, stop editing! Happy blogging. */

//disable Post Revisions

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

define('WP_POST_REVISIONS', false);

disable WordPress post revisions using code

Step 8 – Simply save and close the file by clicking on the ‘Save & Close’ button.

save and close wp-config.php file

You have now successfully disabled the WordPress post revisions and changed the autosave interval. Now, let’s see what this code actually does.

The very first lime is just a comment stating what the code does. It will help you remember what those lines of code are for when you stumble upon your wp-config.php file the next time you need to do something with it. The second line of code changes the autosave interval to 200 seconds which is around 3 minutes. The third line of the code disables post revisions on your WordPress site.

Now that we have seen how to disable post revision on your WordPress blog, let’s see how you can limit post revisions in WordPress.

How to limit post revisions in WordPress

If you just want to limit post revisions in WordPress instead of disabling it completely, I have got you covered. All you need to do is follow the above instructions and copy & paste the below lines of code to your wp-config.php file instead of the code I had shared above to disable post revisions entirely.

//Limit Post Revisions

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

define('WP_POST_REVISIONS', 3);

You can change the numeric value according to your needs. In the above case, we have modified the autosave interval to 200 seconds and the number of post revisions to just 3 which should work well in most cases.

How to clean your WordPress database

Using WP Rocket (Premium Solution)

If you are already using a premium WordPress caching plugin like WP Rocket on your site, you can use its inbuilt database cleaner to optimize your database.

WP Rocket database settings

Using the WP Rocket plugin, you can optimize your database tables and remove post revisions, auto drafts, trashed posts, spam comments, expired transients, etc from your database.

But unfortunately, WP Rocket is a premium WordPress plugin. If you can afford it, I would recommend you to go for it. If you don’t mind shelling out some money to purchase premium plugins, you should definitely check out my list of best WordPress premium plugins. You might stumble upon a few good plugins which can help your site. Anyway, if you don’t want to spend a few dollars for your WordPress site, I’ve got you covered too.

Using WP-Optimize (Free Solution)

WP-Optimize is easily one of the best WordPress optimization plugin available out there that can help you optimize your WordPress database. It helps you clean and optimizes your database automatically. Since it is a dedicated WordPress database cleanup and optimization plugin, it is even more powerful than WP Rocket. Anyway, here’s how you can set up the WP-Optimize plugin on your WordPress site.

Step 1– Install and activate the WP-Optimize plugin from your WordPress dashboard.

install and activate WP Optimize plugin

Step 2– Once the plugin is active on your site, navigate to WP-Optimize’s Database page on your WordPress admin sidebar menu

Run WP Optimize database optimization

Step 3 – Now, the most commonly used WordPress database speedup tricks will be selected by default. You can just click on the ‘Run all selected optimizations’ button to start optimizing your WordPress database.

NOTE: WP-Optimize has also got advanced options which can help you remove expired transients, delete pingbacks and trackbacks, clean post and comment metadata, etc., which can perform intensive database operations. If you don’t know what you are doing, it’s better to leave them at it. Or if you are looking for more ways to optimize your WordPress database, you can take a backup of your site and play with those options.

If you are ready for it, here’s another post on how to optimize your WordPress website. It covers other WordPress speedup and optimization techniques that are beyond the scope of this article.

Thus I hope you learned how to limit or disable WordPress post revisions and make your WordPress site load faster by keeping it optimized using a plugin like WP Rocket or WP-Optimize all year round.

If you found this post helpful and enjoyed the read, please consider sharing this post with your friends and fellow bloggers on social media so that they can also improve their WordPress site speed.

Leave a Comment