post-page

Deleting WordPress Revisions

21
responses
by
 
on
September 28th, 2010
in
HOW-TO, WordPress, WordPress FAQs, WordPress Tips
heading
heading
heading
21
Responses

 

Comments

  1. Bar?? Ünver (1 comments.) says:

    I use WP CleanFix; it has lots of good features: http://wordpress.org/extend/plugins/wp-cleanfix/

  2. Ozh (88 comments.) says:

    I saved more than 55% of my DB when I deleted revisions a couple of weeks ago

    Note that the above SQL query just deletes post marked as revisions. If for some reason you associated a revision with a tag or a category that was then removed when the final post was published, you will have extra entries in other tables such as terms.

    The full query to properly clean your DB from revisions is something like this:

    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’

  3. Rick (3 comments.) says:

    Does limiting the number of revisions using

    define(‘WP_POST_REVISIONS’, 3);

    also limit the revisions on pages? That is where they seem to build up for me.

  4. DouglasVB (9 comments.) says:

    This is a rather timely post. I was just looking for a good plugin to do the dirty work for me of removing all the zillions of post revisions cluttering up my db and along comes your suggestions.

    Nearly 4000 revisions can really add up to be some severe DB clutter.

    Thanks!

  5. Dave Doolin (25 comments.) says:

    I’m using a post revision plugin and setting the number of revisions to 3. Every month or so, I use WP-Optimize and delete all the revisions (after saving a db backup).

    I’d love to have “real” revision history, implemented by storing diffs instead of whole posts… not gonna hold my breath. =)

  6. Otto (215 comments.) says:

    I just use the Revision Control plugin to get fine grained control over revisions. Adjust the number of revisions you want on a per-post or per page basis, with default settings. Much simpler.

  7. Edwin says:

    Didn’t count the size of db before, but it cleared out 4244 rows

  8. Tom Coburn (67 comments.) says:

    I think this should be an option in the wp-admin area, to either delete and or disable the revisioning system. I’m all for backuping, but thats being too paranoid about it. Anyone can run a simple SQL dump in phpmyadmin to backup their entire database, there is no reason that I can think of that a person could ever need the revisioning system, but if they do for some reason, there should be an option to disable it in wp-admin, not just the wp-config.php file

    • Kelson (20 comments.) says:

      “Anyone can run a simple SQL dump in phpmyadmin to backup their entire database” — I hate to break it to you, but not everyone who wants to write text on the internet can (or wants to) write SQL code…or wade through an entire SQL database dump to find the one paragraph or link they wanted to restore from an old draft of one post.

  9. Brian Carnell (15 comments.) says:

    Tom Coburn wrote:

    “there is no reason that I can think of that a person could ever need the revisioning system, but if they do for some reason, there should be an option to disable it in wp-admin, not just the wp-config.php file”

    Weird..I can’t imagine anyone *not* wanting the revisioning system. See http://www.movingtofreedom.org.....ff-viewer/

  10. Scott Winterroth (1 comments.) says:

    Great tip!! Thanks!! Database download size went from 21.4mb to 10.7mb. Amazing… I do typically make a ton of revisions when I post.

  11. finid (2 comments.) says:

    Should the 3 in define( ‘WP_POST_REVISIONS’, 3 ); be enclosed in single quotes or it is not necessary?

  12. Trisha says:

    Really, Brian?

    Weird..I can’t imagine anyone *not* wanting the revisioning system.

    I can understand why some people would like it and find it useful, but I personally detest the revision system and remove it from every WP installation I use.

    Unfortunately, I’ve found that just adding “define(‘WP_POST_REVISIONS’, false );” to my wp-config.php does not do the trick, although it should. I’ve actually had to modify the wp-settings.php file and change the POST_REVISIONS from true to false to make it STOP creating revisions.

    I’m fully in favor of making this an admin option – even if it’s set to “On” as a default – those who like it can keep it, and those of us who don’t get to turn it off without having to monkey around in the core code and repeat our mods every time we upgrade.

  13. Fernanda Thiesen (1 comments.) says:

    i used better-delete-revision and had 8383 entries removed. :)
    database size went from 130mb to 100mb.
    i currently have 983 posts.
    thank you for the tip.

  14. veki (1 comments.) says:

    14796 row(s) deleted. ( Query took 318.4725 sec )

    :)

  15. Galerio says:

    Better Delete Revision uses the sql query suggested by Ozh, so if you are not familiar with sql, just use that plugin

  16. Steve (2 comments.) says:

    As wordpress is used by so many people, its flexibility and functionality are its strengths, thus its good to have this feature.

    As Tom says, not everyone wants or uses this feature, so it would be nice to have this as an option in the admin settings section. As we have seen from the comments, this feature is adding substantially to the database size, especially for heavily modified sites. This can impact on performance.

    Part of the problem is people are not even aware of the impact thus having an option in the admin section will at least make people aware and look into whether they need it!

  17. Mazhar (2 comments.) says:

    Thanks for sharing this dude. Just removed 878 revisions from my DB. There is also this plugin called revision control, but then I dont use many plugins as it brings down the speed of wordpress



Obviously Powered by WordPress. © 2003-2013

page counter
css.php