Thinking of limit post revisions in WordPress? you are at the right place. I agree a slower website can turn off the viewer and force them to close the site. Even if you have awesome content in your website.
So, you should optimize WordPress database regularly to speed up your Website which would be a big relief and provide better user experience.
And I agree it’s not possible to take care of the website all the time. So here you can always take help of some tools.
At the same time, WordPress CMS designed in such a manner, that it creates revisions to rescue the content. So that in case anything goes wrong, you can always revert.
But, dramatically it increases the WordPress database size, as it creates a copy after some intervals and stored in the WP database.
Nothing to panic, adding some code to the core files, will do the maintenance part.
To make the website lighter you need to clean up the WordPress database regularly with the WP-Sweep plugin.
Because all the revisions use to get stored in the WordPress database.
So here we are going to see how we could limit the Revisions to get created in WP post.
How To Limit Post Revisions in WordPress
This process is quite simple, can be done just by adding a simple code in the WP-Config file.
Step 1. Open your Hosting CPanel and login to it.
Step 2. Now you need a wp config.php file, which can be accessed from the Hosting Control Panel – File Manager, there you would be able to find it.
Step 3. Once you see all the files look for WP-Config.php, then right-click on it and select Code Edit. to add some code into the file.
Note: It’s always good to take a backup of the file just being on the safe side, right-click on the WP-config file, and download it.
It will open up the editor and we are about to add some code to limit the revisions.
In this section find a code which looks something like this,
define(‘WP_DEBUG’, false);
/* That’s all, stop editing! Happy blogging. */
Step 4. Now paste the below code, above it.
/* Sets limit on WordPress revisions */
define(‘WP_POST_REVISIONS’, 2);
Here, the number “2” mentioned because we would like to create 2 revisions only. You can change it, the number of revisions you would like to store in.
It’s highly recommended to keep it minimal to keep the WordPress database to be light-weight. After all, that is the exact purpose of doing it. Or else, you will end up storing a lot of revisions for your entire site.
Make sure you are putting the code at the right place in WP-config. It won’t work if do it below ( !defined(‘ABSPATH‘) ),
Check out an example of the earlier published post, see the number of revisions it created.
Just assume if one post creates so many, then what the post revisions would be for your entire site. It was just an example, it creates more every time you make an update to your posts.
Once done, save the WP-config.php file and you are done. You have successfully restricted the revisions.
Now you would be able to see the changes while editing any of your posts, check out the image as an example. Due to we have made some revision control to “2”. So, it’s not creating more than that.
And just in case, if you want WordPress not to create any revisions at all. Disabling it, also possible easily.
Disable the WordPress Post Revisions
The process is the same for even this, just replace the number “2” with “false,” That means it will look something like this.
/* Sets limit on WordPress revisions */
define(‘WP_POST_REVISIONS’, false);
You can test this, whether it is working on not. Again open any of your posts, you won’t be able to see the revisions options at all.
Doing the WordPress cleanup, can keep the database tidy and speed up your WordPress site. Above procedure is quite handy for those who don’t want to install too many plugins.
Though few plugins also do the job, WP-Sweep is the recommended one to clear the revisions and clean the WP database.
Do share the article if it helped you by reducing your WordPress database size. I would like to hear, the comment section is open for you.
This is amazing. I was always fed up of the large number of revisions. Your article is helpful to increase the blog speed!
Hi Prudhvi,
It’s always recommended to disable the post revisions completely and have a regular WordPress database cleanup for your site.
Hi, Your Article nice and Keep Sharing your Article on page
Thanks for your guidelines
Hi Navin,
Fantastic post and so much to learn. It’s very helpful for me & my friends who use wordpress. You are clearly describe all points step by step which are easy to understand by screenshot.
keep it up great work
Thanks for kind words. And yes limiting or disabling the revisions makes a huge impact on site loading speed.
Have a great day ahead!
Navin
wow, I really love the way you took your time and explained everything, will implement those wonderful tutors on my Blog.