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.
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
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
Clicking “SQL” tab (3) will guide you to the SQL query form.
Make sure you have selected the appropriate database, click on the text area (4).
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).
- It’s highly recommended to backup your database before you perform this action.
- If your table prefix is not “wp” (default value), you should replace it with the prefix that you defined.
phpMyAdmin will ask you to confirm this action, click “Yes” (7) to perform the SQL query command.
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.