Disable / Limit and Delete WordPress post revisions.

Posted by iKevinShah in Webmaster12 October, 2013

WordPress post revisions, a feature added by wordpress in 2.6 udpate, automatically stores each revision /edit being made to each post in wordpress. This, as a result, occupies huge amount of size in your database depending upon the post frequency and size of the blog / website overall. Each post has multiple entries in the database occupying the space. Obviously, it has its own benefits as the revisions might be helpful in UNDOing some of the revisions which you did, nevertheless its a good idea to limit the revisions.

Technically if you edit the posts 20 times, wordpress will save all 20 revisions of it in the database with the latest one being public.Memory used in database is 20 times the memory used for a single post!

So I decided to limit the POST Revisions on my blog and deleted all post revisions !


To disable Post revisions simply open wp-config.php (LOCATED IN ROOT DIRECTORY OF YOUR SITE), and add this line to it :

define('WP_POST_REVISIONS', false );

or we might have to limit post revisions, meaning post revisions might be on, but only "X" amount of revisions will be stored in database.

Limiting POST Revisions

If you want to limit post revisions on your blog, just edit the wp-config.php file, add this on the last line.

define('WP_POST_REVISIONS', 3);


and after you're done, if you want to DELETE all exisitng post revisions in your database, go to PHPMYADMIN, and execute this SQL Query (make sure you edit the prefix "WP" to what you have in your blog).

WARNING : By doing this, you will delete all your post revisions.YOU HAD BEEN WARNED.

DELETE FROM WP_posts WHERE post_type = "revision";

Thats it, you have deleted all post revisions.

Note: Please note that, if you update the wp-config file, it might get changed everytime a wordpress release is available and eventually upgraded. So make a note of it and make sure to check it every time you upgrade your wordpress install.

  October 12, 2013, 7:28 am