Turn Off Post Revisions in WordPress 2.6 Onwards

Posted In WordPress - By NitiN Kumar Jain On Tuesday, August 25th, 2009 With 0 Comments

Pin It

The most irritating feature in WordPress 2.6 onwards is the post revision feature specially for those who own and write their blogs themselves.

Just in case you are wondering what is post revision, whenever a post is edited, a new data row is created in the wp_posts table. So if your posts or pages got edited 10 times, you will have 10 new rows in wp_posts table.

Sooner or later your wp_posts table will be filled up occupying a lot of database space and the post ID will be keep increasing.

WordPress supports switching off this feature. You just need to add the following line to wp-config.php:

define('WP_POST_REVISIONS', false)

This will cater to the post revisions in the future but what is to be done for the already created records?

You can delete all post revisions by running this query in phpMyAdmin:

Note: Be sure to backup your database first before performing any queries in phpMyAdmin.

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'