Whenever you edit a post or page, WordPress makes several copies of the same. As helpful as it is, a lot of post revisions may over time add a lot of weight to a database. Using a simple configuration setting, we will demonstrate in this tutorial how to restrict the number of times a post can be revised in WordPress.
You should amend the file wp-config.php that is in the root directory of your WordPress installation.
Before the line in which it says /* That's all, stop editing! Happy blogging. */, add the following line of code:
define( 'WP_POST_REVISIONS', 5 );
Above line restricts WordPress to 5 revisions per post or page. Revisions that are old by default will be deleted.
How to Disable Post Revisions Completely?
To completely turn off post revisions, or you can use the following code instead:
define( 'WP_POST_REVISIONS', false );
Save the wp-config.php file and continue editing your posts as usual. Limiting the number of post revision prevents the heavy size of the database, enhances performance and ensures your WordPress installation is optimized.