WordPress – How to limit post revisions

By default, posts and pages in wordpress save previous versions when updates are saved.

WordPress-LimitRevisions1

This can be helpful if you need to refer to a previous version, but also creates additional overhead on your WordPress installation by storing additional records in the database for each update.

The steps below detail how to configure WordPress  to limit the revisions. The process requires access to the WordPress files on the web server, specifically wp-config.php.

  1. Using FTP or your websites cPanel access, open the wp-config.php file in the root of your WordPress installation
  2. At the top of the file, below the <?php add the following code
  3. define('WP_POST_REVISIONS', 3);
  4. WordPress-LimitRevisions2
  5. And save the changes.
  6. In this example we’ve configured 3 revisions, this will create four entries in the database – one for the published post and three revisions.
  7. If you have an existing post with more than 3 revisions the next time the post is updated the additional revisions will be removed from the database.

Was this article helpful?

Related Articles