Is your WordPress blog optimized for speed? WordPress speed is important as WordPress SEO. When the speed optimization thing comes to our mind, we will check out the hosting environment, consider a caching plugin like WP Rocket, an image optimization plugin like ShortPixel on top of a lightweight theme.
Well, there is a thing which most beginners don’t know. Your database optimized for speed? No. If you are blogging for a while probably NOT optimized for speed!
When WordPress speed optimization comes to my mind, this is the one tactic that I use for optimizing the database – disable WordPress post revisions. Thankfully, there’s a coding method and also plugin method available for disabling post revisions. In this post, we will cover them both and also a way to clear the existing post revisions.
When Do You Need To Disable WordPress Post Revisions?
Let’s say you are running a news website. Not a small one. A big one with lots of readerships. So when you run news websites, you may want to consider updating it according to new changes.
So, when you simply save a draft while completing the post or updating the existing one, a revision is being generated!
Keeping all these inside your database is not a good option. It will make your website slower. For preventing this thing, you could consider disabling the WordPress post revisions or limiting them. Most popular website hosting companies like WP Engine got limited this feature in their environment.
A secret of their lightning fast hosting environment.
Now, let’s see how can we disable them or limit them.
How To Disable WordPress Post Revisions Using Code?
The coding method is pretty simple. All you need to do is, simply add some additional code to one of your WordPress core files – the wp-config.php file.
You may want to use a dedicated plugin like WP File Manager, an FTP client like FileZilla or you need to access the core files using the cPanel’s file manager.
The wp-config.php holds your website’s database credentials and related important configurations. So before editing it, I recommend you taking a back up of it. Just simply download the wp-config.php file to your local storage.
After that, you are good to go.
Simply open the wp-config.php file. Find the line says “That’s all! Stop Editing”. Just before the line, paste the below code.
//disable WP Post Revisions
define('AUTOSAVE_INTERVAL', 300); // seconds
The code will disable the post revisions! In case if you want to limit them instead of disabling, use the below code.
//limit WP post revisions
define('AUTOSAVE_INTERVAL', 300); // seconds
This code will save only 3 recent revisions of your post in the database! According to saving unlimited revisions and making the database heavy, this is a better way.
Now, save the wp-config.php file. From now on, the revisions will not get saved. So, you can focus on your work.
The Plugin Method
If you don’t want to mess up with codes and need a plugin to do the job, there’s a premium plugin available called the perfmatters. That’s a plugin for WordPress speed optimization and using it, you can disable the post revisions or limit them.
Once you have chosen your limit, simply save the plugin settings and you are now good to go.
Which Method Is Best?
Both methods work fine. In our blog, we are disabled the WordPress post revisions using code. You could do the same thing if you’d like. Thankfully, the method will work fine with WordPress 5.0 and above the Gutenberg.
The plugin perfmatters will bring some more additional and advanced optimization tricks. If you purchase that plugin, you can speed up your website within some minutes! So choose a method which you feels perfect.
Optimizing The Database
You have already got some revisions in your database right, We no longer need that. Here, we are going to show you how to optimize the database.
You need to install the plugin WP-Optimize. Once you are done, go to the WP-Optimize plugin settings.
There, you can see all the optimization opportunities. Select the optimizations you need to clear and click on the run optimization button.
And now you can see that the plugin got optimized entire database!
Pretty cool isn’t it?
This is how you can disable WordPress post revisions. You need to really consider this tip. It will make your WordPress blog faster!
We hope you found this post helpful and enjoyed the read. If you did, please consider sharing this post with your friends and fellow bloggers on social media. You may also want to check out our posts about how to fix logout error in WordPress and how to stop spam in WordPress.