/How To Turn Off Post Revision In WordPress

How To Turn Off Post Revision In WordPress

Wordpress has added the post revision feature on version 2.6 of their blogging software. If you’ve ever wonder how it works and why you should be worried about it, here’s why: Every time a post on your blog is edited, it creates a new row on the wp_posts table. To put that into perspective, If you’ve edited a post 10 times, you’ll have 10 new rows in the wp_posts table. If you have edited 10 posts at least 10 times then you’ll have 100 new rows in the wp_posts table.

If left alone, your wp_posts table will be filled up, causing performance issues (imagine selecting through 100,000 records).

While this feature is indeed useful, it does poses some problems later on because WordPress does not allow you to clean your revisions once you’ve made the final version of your post. Everything remains in the database.

To turn off this feature, add this following code to wp-config.php:

define('WP_POST_REVISIONS', false);

To delete all previous post revisions, run this query 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'

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