Get rid of unnecessary post revisions – WordPress

WordPress has very useful function to store previous sessions and copies of every post to restore, if you lost your connection or you want to compare your post with another post. Its a good feature but at the same time, it takes a lot of space in your database. Here I have a piece of code to remove unnecessary post revisions.

Please backup your database before executing these codes.

Simply go to you phpMyAdmin > Select your Database >SQL query > Execute the following command and then Go.

DELETE a,b,c
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id)
WHERE a.post_type = 'revision'
Get rid of unnecessary post revisions – WordPress 1

Comments

4 responses to “Get rid of unnecessary post revisions – WordPress”

  1. kevin davis Avatar
    kevin davis

    Good post, thanks

  2. I am very pleased you wrote that!!!

    Tricia

  3. Staten Locksmith Avatar
    Staten Locksmith

    Awesome post Muzammil, it’s been a while since I’ve been on here. I see that nobody has lost their passion. Good to be back.

  4. potenzmittel shop Avatar
    potenzmittel shop

    Simply discovered your web page through google and I consider this can be a disgrace that you are not ranked upper due to the fact that that is a Great post. To switch this I determined to avoid wasting your Blog to my RSS reader and I will try to point out you in one of my posts since you actually deserv extra readers when publishing content material of this high quality.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.