Disable Post Revisions in WordPress

WordPress provides a very good feature of maintaining post/page revisions. By default this feature is enabled so wordpress will save copies of each edit made to a post or page; this provides us a provision to revert to a previous version of that post/page.

While you website is in development mode, you may want to disable the “Post Revisions” feature. Also website owners with limited database space may want to disable this feature or limit the number revisions saved.

Lets see the related settings to be made in the configuration file “wp-config.php” located in your WordPress root directory.


Disable Post Revisions

Add the following setting just below the comment block in wp-config.php file

define( 'WP_POST_REVISIONS', false );


define( 'WP_POST_REVISIONS', 0 );


Specify the Number of Post Revisions

In case you are looking to specify the maximum number of revisions to be maintained then you can specify a number. In below example we are setting the maximum number of revision to be maintained to 5.

define( 'WP_POST_REVISIONS', 5 );

Note: It is recommended that you add this setting at the top of other settings just below the comment block.


Modify AutoSave Interval

WordPress auto-saves post revisions using AJAX while editing a post after a predefined time, by default this time is 60 seconds.

You can increase this time as below in the wp-config.php file

define( 'AUTOSAVE_INTERVAL', 260 ); // Seconds


define( 'AUTOSAVE_INTERVAL', false );


define( 'AUTOSAVE_INTERVAL', 0 );

does not disable auto-saving post revisions.


Delete all previous revisions

If some revisions have already been created before disabling the post revisions and you want to delete all the revisions created so far then,

Run the following sql query

DELETE FROM wp_posts WHERE post_type = "revision";

Leave a Comment

Back to top