Once you post something on your Blog, I am pretty sure that once in a while you might need to re-edit that post. There might be various reasons why you want to re-edit or modify your post. Whether it’s because of your content or simple spelling error, we do that quite often and this is a fact.
However, every time you re-edit the post or page WordPress keeps the track of it by default. It has both good and bad side of it depending on what exactly you want to do with your post. Good part is, before you re-edit the post you can see the time when you edited the post for the last time. If you want to revert your post that could be a good option. But the bad part of it is, it will make your database heavier. Think about the scenario that you have over couple of thousands of posts and among them couple of hundreds of posts has a revision copy of it. This is problematic, at least for me.
So, I was basically looking for a solution to resolve this issue and finally I found one. You have two different option available here. Either you can disable the revisions permanently or specify the number of time of revisions. In this post I will show you both. Let’s get started.
Before I show you the code, please keep it in mind that like most of the time we won’t be dealing with your theme’s functions.php file today. It would be one of the core WordPress file called “wp-config.php“. You can find this file at the root directory of your WordPress site. This is a very important file of your WordPress site so, I strongly recommend you to keep a backup copy of this file before your start editing.
Permanently Disabling the Revisions
Open up the wp-config.php file with your HTML editor or simply with Notepad. Find the following line from the page.
/* That's all, stop editing! Happy blogging. */
Now copy and paste the following line before the line I mentioned above.
define('WP_POST_REVISIONS', false );
Save the file (wp-config.php) and upload it to the root directory of your site. This simple line of code will disable the Revisions system on your blog post.
Specify the Number of Post Revisions
How about defining a number post revisions time? All you need to do is to copy and paste the following code above the line that I already have mentioned.
Change the number with your desired one.
This is pretty much it. Now, it’s your turn to think which one you want to use on your site. Let us know if you find our posts helpful for you or not.
Source: WordPress Codex