Add a setting to limit the number of revisions stored in the database

All revisions to posts and pages are saved by default. This can lead to unnecessary bloat in the database over time. I suggest adding a simple number box on the Settings → Writing page to allow users to set the number of revisions saved (with zero indicating no revisions are to be kept).

Read-only archive:

Author: Alan Coggins

Vote count: 20

Status: open


This was my petition and agree that it is better done with code as needed. You can close this one @viktor


For anyone looking for a solution, revisions can be limited using a constant inside wp-config.php:

define( 'WP_POST_REVISIONS', 3 );

This petition will auto close in 14 days to give users time to contest status change.


I’ll definite add this to my wp-config.php. Been using a DB cleaner to remove revisions.

btw, this includes both posts and pages, right?


That’s correct. Including custom post types if they support revisions.

Note that this constant (and the example) will only create up to 3 revisions from-then-on. In other words, if you already have a bunch of revisions in the database for a given post, you’re still going to have all those old revisions in the database; just, only 3 new ones would ever be created.


That’s good to now. I’m thinking of adding an Announcement CPT.


This topic was automatically closed after 14 days. New replies are no longer allowed.