How to Limit or Disable WordPress Post Revisions

Limit the number of posts revisions that WordPress stores in the database.

Post Revisions

edit wp-config.php file in WordPress root:

WP_POST_REVISIONS:

  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except the one autosave per post)
  • (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.

 

Example:-

Step 1:-

First we will need to open up your wp-config.php file. This is located in the root of your WordPress site.

Step 2:-

Insert the following code in wp-config.php file.

or

Note: This needs to be inserted above the ‘ABSPATH’ otherwise it won’t work.