WordPress, Disable and Delete Post Revisions

Posted: 2009-02-17 10:07:54

Post revisions are one of the more useless features of WordPress that do little but add bloat to the database.

At first they were kind of cool, but then what do you do with them?

You’re not running a wiki. Right?

Here is how to get rid of them once and for all.

Edit wp-config.php, add this line in to disable the post revisions feature.

define('WP_POST_REVISIONS', false);

You will also need to clean the database of all the previous entries under the wp_posts and wp_postmeta tables.

use database_name;
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';

Congratulations, you are done! Enjoy your now much smaller database.