How To Limit The Number Of Post Revision In WordPress

Post Revision In WordPress

Whenever you make any changes in a post and update it, WordPress saves it a draft copy. Since by default WordPress does not limit the number of post revisions / draft that are saved, post revisions can be a waste.

Post revisions is a WordPress feature that allows you to undo changes and go back to an earlier version of your posts and pages.

For each draft you are working on, WordPress automatically saves a temporary revision. This type of revision is called auto-save.

Because every time you click on the update tab in the WordPress editor, it gets saved as a draft copy. This takes up the same amount of storage space in your database.

For example if you update a post ten times, WordPress stores it as ten published post on your server. That’s a lot of storage space being wasted.

Thankfully, WordPress allows you to limit the number of post revision in WordPress / drafts that are saved

I personally feel that two or three post revisions is more than sufficient. I don’t see any reason why you should have more post revisions saved. Many website owners reduce this to just one.

Check out: How To Defer Parsing Of Javascript In WordPress

I frequently update some of my popular articles, with the latest infos. As you can see from the below image, wordpress has saved 9 (nine) revisions of one of my posts. This is way too many, as each revision is taking storage space of 9 full posts.
limit Post Revision WordPress does allow you to limit the number of post revision that are saved on your server.
All you need to do, is to add a line of code to your wp-config.php file.

define( ‘WP_POST_REVISIONS’ , 3 );

Note: The above code will restrict post revision in WordPress to 3. Any additional post revisions will automatically replace the older version. See the image below where to add this code in wp-config.php.

limit Post Revision
If you wish, you can also completely disable post revision, by changing the value in the above code to “0” or “False”
Many website owner are not comfortable with editing codes. If you are one of them, I would recommend using a plugin such as Simple Revision Control, to restrict post revision in WordPress.