Categories: Wordpress

How To Turn Off Post Revision In WordPress

Published on November 26th, 2009 | by sylv3rblade

3

wp-logo
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.

Tags: ,



3 Responses to How To Turn Off Post Revision In WordPress

  1. chris says:

    is it possible to delete a particular post revision?

  2. Rama says:

    define(‘WP_POST_REVISIONS’, false); has since been disabled!!!

    This fix no longer works on 2.9.1

    Is there another way?

    πŸ™

Back to Top ↑

website stats