Limit the number of WordPress post revisions

WordPress post revisions can be handy, especially if you make a mistake but too many revisions can add unnecessary bloat to the database.

With this snippet, you can limit the number of revisions WordPress stores for any page or post. You can add this to your wp-config.php file.

// Keep 3 revisions max
define('WP_POST_REVISIONS', 3);

You can also disable revisions entirely.

// Disable revisions
define('WP_POST_REVISIONS', false);

– LAST TESTED DECEMBER 9, 2019

Code not working? Let us know in the comments below.

Latest Snippets

Leave a comment