How to delete unused post revisions from your WordPress Database

If you are like me, sometimes you update WordPress posts quite a lot, which can lead to a long list of Post Revisions for your posts. While this is very helpful if you need to go back to a recent version of the post, sometimes it can get cluttered.

Just head over to phpMyAdmin from your Site Hosting Account, and run the following query on your WordPress database. This will delete all post revisions and the meta associated with them from your WordPress database. I strongly suggest making a backup of your WordPress database before running this query, which is always a good idea for any changes to your database.

DELETE a,b,c
FROM wp_posts a
WHERE a.post_type = 'revision'
LEFT JOIN wp_term_relationships b
ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id);

Now that these Post Revisions are gone, your WordPress posts should be a little less cluttered.

Also, click here if you would like to learn how to disable or limit the WordPress Post Revisions Feature.

   Related Sponsored Links

Disclaimer: The information contained in this website is for general information purposes only and in no event will this site or its owners be liable for any losses or damages associated with your use of our site or content. Click here to see our full Disclaimer.


  1. techalam says:

    Just what I needed. Thanks for the code and tweeted 🙂

Leave a Comment