How to Manage Page or Post Revisions in WordPress

WordPress has a revision feature which saves post revisions which is useful if later you want to rollback to previous version of your page/post but saving many revisions of posts will consume extra space in your database which can also affect performance of your live site, but if we can avoid it by controlling the number of revisions or disabling it.

Disabling Page/Post Revisions

To disable revisions permanently from your website, open wp-config.php file and add this line of code:

define( ‘WP_POST_REVISIONS’, false );

but at later stage if you want to enable this again then you can enable it again

Enabling Page/Post Revisions

To enable revisions from your website, open wp-config.php file and find this line of code:

define( ‘WP_POST_REVISIONS’, false);

if the above code was not found then no need to do anything it is enabled by default.
Otherwise replace with below code.

define( ‘WP_POST_REVISIONS’, true);

Adding Limit to Page/Post Revisions

If you want to save revisions up to a limit so that your database space is not consumed more then you can also limit the number of revisions.
Add below code to your wp-config.php file

define( ‘WP_POST_REVISIONS’, 5 );
This will limit revisions to 5, you can set limit according to your wish

Changing Auto save Time

You can also increase the autosave time interval of posts, use below code in config.php file

define( ‘AUTOSAVE_INTERVAL’, 800 );

Deleting Old Post Revision Data from Database

Go to phpmyadmin and select your database(make sure you have selected correct database) and run below SQL query

DELETE from wp_posts WHERE post_type = "revision";
Above query will work if you are using default table prefix “wp_”
For custom prefix update the query with your prefix
Example your table prefix is “abc_” then your query will be
DELETE from abc_posts WHERE post_type = "revision";

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: