Delete all Post revision from WordPress Database at One Go

by Themepremium on November 14, 2009


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.

Related posts:

  1. WordPress Post-Revision feature- Do you really need it?
  2. Revision Control WordPress plugin : Disable or Limit Post revision in WordPress
  3. Disable WordPress Post revision Without Plugin
  4. Optimize WordPress Database With Wp-Optimize WordPress Plugin
  5. How to Make a WordPress Post Always Stick to Homepage

Wpfreelancer

{ 5 comments… read them below or add one }

Pubudu Kodikara November 15, 2009 at 6:34 pm

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

Reply

David Radovanovic December 14, 2009 at 4:11 am

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

Thanks!

Reply

David Radovanovic December 14, 2009 at 4:22 am

Add

define('WP_POST_REVISIONS', false);

to wp-config.php

Reply

Ashfame February 19, 2010 at 1:43 am

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

Reply

Ashfame April 14, 2010 at 1:18 pm

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/

Reply

Leave a Comment

Previous post:

Next post:

.