Avoid or limit revisions

When you edit a page or post the old version will automatically be saved. Every time you edit a page or post, the old version is saved. These old versions pollute the database unnecessary, especially when you never delete them. You can install a plugin to manage and/or delete the revisions and clean up your database. You can also set a limit to the number of saved revisions or avoid saving revisions completely with some code.

When you have no need to keep old versions at all, you can add the following code to wp-config.php.

// disable post revisions
define('WP_POST_REVISIONS', false);

When you do not want to entirely disable saving revisions, but want to restrict, for example, to the last five, add the following code to your wp-config.php.

// limit five post revisions
define('WP_POST_REVISIONS', 5);

Always backup wp-config.php before you make any changes to it!

Ronald Heijnes
Ronald Heijnes

Since 2008 I keep myself busy with the functionality, management, maintenance and performance of self hosted WordPress. I like to share this knowledge. All in my spare time!

Articles: 44

Leave a Reply

Your email address will not be published. Required fields are marked *