How to Delete All Post Revisions Manually in WordPress

Prior to this post, I have posted an easy way to turn off post revision in WordPress, but don’t forget the huge post revisions are still existing in your MySQL database. Today I will show you how to delete all post revisions by manually.

Delete Post Revisions in WordPress

Illustration: Deleting post revisions is easy!
Image licensed by Feverpitched | Dreamstime.com
Image modified by Terry | PCDIY.com

Manually Delete Post Revisions

Does your web hosting space provide a MySQL GUI management tool called “phpMyAdmin” or others? It is better if you use phpMyAdmin to manage your MySQL database, the following way might be easy for you.

Step 1: Login to Your MySQL GUI Tool

phpMyAdmin Select Database

Image A-1: Select the appropriate database.
Screenshots by Terry | PCDIY.com

The first step to delete or remove all post revisions from your database is to login to your phpMyAdmin (or other MySQL GUI tools), then select the appropriate database (1).

For example, my wordpress database is named “pcdiy”, I have to select “pcdiy” (2) before the next steps. As shown as screenshots.

Step 2: Run a SQL Query for Deleting Post Revision Rows

Use SQL Command Line

Image A-3: Go to SQL query form.

Clicking “SQL” tab (3) will guide you to the SQL query form.

Run SQL Query for Deleting Post Revisions

Image A-4: SQL command form.

Make sure you have selected the appropriate database, click on the text area (4).

Enter SQL query command

Image A-5: Enter a SQL command.

Enter the SQL command below (5):

DELETE a,b  
FROM wp_posts a, wp_term_relationships b 
WHERE a.post_type = 'revision' 
AND a.ID = b.object_id

Then click “Go” (6).

Notes

  1. It’s highly recommended to backup your database before you perform this action.
  2. If your table prefix is not “wp” (default value), you should replace it with the prefix that you defined.

Confirm Action, Yes

phpMyAdmin will ask you to confirm this action, click “Yes” (7) to perform the SQL query command.

Remove Post Revisions Successfully

All post revision rows in wp_posts and wp_term_relationships have been removed successfully. I spent 5 hours to write this article, hope this helps.

Do you like this article?
Related Posts
One Response to “How to Delete All Post Revisions Manually in WordPress”
  • simon Says
  • Hey thanks for presenting this usefull article…I would love to subscribe to your blog

  • 2011-05-10 4:22 am
Leave a Reply

Only useful comments will be allowed.

Copyright © 2007-2012 Pcdiy How-to Blog. Some Rights Reserved. Privacy Policy