Support » Fixing WordPress » How to delete revisions once a post is final?

  • I don’t want to carry revisions of posts in my database. It adds to backup time and as I hit save frequently when I write it means I end up with a database that is mostly revisions.

    What’s the best way of cleaning this up?

    I’m using WP 2.6.3

Viewing 5 replies - 1 through 5 (of 5 total)
  • There is a Revision Control plugin which gives you some control over revision retention.

    Revision Control

    Very cool, stvwlf. Thanks.

    You can also just add this to your wp-config.php file:

    // To turn off revisions and extend autosave to one hour interval.
    define (‘WP_POST_REVISIONS’, 0);
    define(‘AUTOSAVE_INTERVAL’, 600); // One hour should be long enough!

    Change ‘0’ to however many revisions you want to save.

    You can add this line to your config.php to turn off revisions completely
    define(‘WP_POST_REVISIONS’, false);

    I did this because I was constantly updating revisions, too, and they were eating away at my database.

    I still had the problem of all those extra revisions left in my database, though. I ran this in phpMyAdmin to get delete all the revisions:

    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’

    This seems to only prevent WP from displaying the post revisions. When I go into the database the revision is still posted as a new entry.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to delete revisions once a post is final?’ is closed to new replies.