• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WordPress Tips, Code Snippets, and How To Tutorials

  • Home
  • Blog
  • Tips
  • Snippets
  • Tutorials
  • Contact

How to delete unused post revisions from your WordPress Database

August 5, 2015 by admin 1 Comment

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.

If you like this then you should look up more of our WordPress Tips Code Snippets and Tutorials.

Disclosure: There are affiliate links on posts and throughout the website and if you use the links to make a purchase we may earn a commission from it. We link to these companies and their products because of the quality of the companies and not because of the commission we may receive from it.

Disclaimer: The information contained in this website is for general information purposes only and in no event will this website or its owners be liable for any losses or damages associated with your use of our website or content. We recommend that you make a backup of your website before you make updates to it. Click here to see our full Disclaimer.

Filed Under: WordPress Tips Tagged With: Database, phpMyAdmin, Post Revisions, SQL, SQL Queries

Reader Interactions

Comments

  1. techalam says

    April 29, 2013 at 1:30 pm

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

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Hey, We Deliver... Anywhere!

Enter Email Address below to receive our snacks via email:

Join Over 1200 Readers!

Jump To A Random WordPress Tip

Copyright © 2019 • wpsnacks.com