If you are a blogger using WordPress for your website, then you’d have noticed that if you are typing a new blog post, the versions of it are stored in your WordPress database. Most of the times, you’d never need the earlier versions of what you are writing.
This has a downside, especially because the cost of using up space in your database will eat it up sooner or later, thus costing you money eventually to be paid to your web hosting service provider.
Fortunately, there is a very easy way to mitigate this feature in WordPress. That’s where the wp-config.php file comes in to play. Here’s how:
I highly recommend taking a backup of your blog before making any changes to your database and wp config files. These are pretty advanced changes, and I hope I don’t make it seem so though…
How to disable or reduce the post revisions count in WordPress:
This is done programmatically, so you’d need to edit your wp-config.php file. There are many ways by which you can edit your wp-config file – but I am going to show you how to use Filezilla to achieve this. (by the way, Filezilla is a real cool tool. You should give it a try)
Install Filezilla from here, which is a free FTP solution. This can also be used to efficiently back up your website related WordPress files manually to your local workstation.
Once installed, you’d need to know your ftp database’s name – which can be found in your web host’s control panel. Of course, I assume that you already have your ftp setup done with your web host.
Here’s how the login screen looks after you open your Filezilla client:
Login to your FTP account using your credentials and click on ‘Quickconnect‘ button – this is how you give permissions to yourself to edit your core WordPress directories and files.
A running status shows whether Filezilla was able to establish a connection with the server. Once done, on the right side of your Filezilla client you can see that there is a folder tree with directories and subdirectories. That’s where you can find the files of all your website content.
Just click on your ftp folder name to expand it – and you’ll find the wp-config.php file displayed in the folder contents below. You can open/edit or even download the file as required.
Once opened within the Filezilla file viewer, paste the below code at the end of your wp config file to reduce or remove the post revisions feature:
This code disables this feature:
define( 'WP_POST_REVISIONS', false );
And this code will modify the number of times your revisions are kept in stock, change the ‘false’ to an integer/number like this:
define( 'WP_POST_REVISIONS', 3 );
Note: Some users have to move this command to the first line under the initial block comment in config.php to make it work.
Source: Disabling Post Revisions
Bonus information:
If you are like me, you’d be more inclined to the safety of your blog or website to reduce its vulnerability. In such cases, these articles might become your best friend in need:
Hardening WordPress
Securing wp-config.php file
What could a hacker do with my wp-config.php
How to Increase PHP Memory Limit in WordPress