Delete all Post revision from WordPress Database at One Go

Earlier we talked about WordPress post revision feature and how you can disable post revision with plugin or disable post revision with little hack. Though we have achieved the target to disable the post revision feature but still most important thing that remains there is deleting all previous version of WordPress post revision. If you have hundred+ posts you can see lots of post revision on your blog and obviously your wordpress database size will be big. To delete previous post revision you can run this query in your sql database to delete all instance of previous auto saved blog posts.

DELETE FROM wp_posts WHERE post_type = "revision";

Make sure you take the database backup before running this query. This will ensure the safety of your wordpress database. Alternatively you can use wp-optimize wordpress plugin, if you are not familiar with running sql query.

share on twitter

Comments

  1. Pubudu Kodikara says:

    If i delete all the past revisions, will it help to increase the performance of my blog?

  2. David Radovanovic says:

    Is there a hook that can be included in the functions.php to prevent the revision writing?

    Thanks!

  3. David Radovanovic says:

    Add

    1
    define('WP_POST_REVISIONS', false);

    to wp-config.php

  4. Ashfame says:

    This is not the correct way of deleting revisions. Don’t do it this way.

  5. Ashfame says:

    Again came to this post when I just searched how many people are telling the same query to solve the problem. Finally I blogged about the correct method of doing it – http://blog.ashfame.com/2010/04/handling-wordpress-post-revisions-correctly/

  6. neurowave says:

    No, it’ll just save u disk space ….

  7. neurowave says:

    Yes :) this would delete all the relations too … :) ..

  8. Themepremium says:

    And also optimize your database..make it smaller in size..!!

Leave a Reply

© 2009-2011 ThemePremium · All Rights Reserved
A threeroutes media Publication