WordPress.org

Forums

How to delete revisions once a post is final? (6 posts)

  1. ponolan
    Member
    Posted 6 years ago #

    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

  2. stvwlf
    Member
    Posted 6 years ago #

    There is a Revision Control plugin which gives you some control over revision retention.
    http://dd32.id.au/wordpress-plugins/revision-control/

  3. DianeV
    Member
    Posted 6 years ago #

    Very cool, stvwlf. Thanks.

  4. Wendel Brume
    Member
    Posted 6 years ago #

    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.

  5. MrCardinal
    Member
    Posted 6 years ago #

    http://www.lancelhoff.com/2008/08/15/how-to-disable-or-turn-off-wordpress-post-revisions/

    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'

  6. gregorymcg
    Member
    Posted 6 years ago #

    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.

    Greg

Topic Closed

This topic has been closed to new replies.

About this Topic