Solved: How to delete revisions of wordpress posts?

You may have noticed that wordpress keep revisions of your old posts.
These revisions can be useful if you want to go back to an older version of a post. But if you are sure that you no longer need those old versions of post than it’s best to get rid of them.
Deleting the old posts will give you precious space which you can use for posting new articles. Also it will make your database querying fast.
Here we will discuss about how to delete old revisions.
If you don’t like plugins you can follow these simple steps. Else, directly go to Step 4 to check plugins for doing this.
1) Login to your hosting server and get inside your sql database.(If you are using AWS check this post on how to login.)
mysql -u root -p
2) Select the wordpress database
mysql> USE wordpress;
3) Delete the posts with type “revision”. This command will delete all revisions of all your posts leaving only the latest version.
DELETE from wp_posts WHERE post_type = “revision”;
You can run this DELETE query in your phpmyadmin console also.
4) If you are not comfortable with command line or coding . You can simply install a plugin called “Simple Revisions Delete” in your wordpress dashboard. It will provide you “Purge” option in each of your post to purge old revisions.
Caution:- Before you decide to delete revisions, it’s better to take backup of DB and be absolutely sure that you want to do this. As the only way to get them back after deletion will be to restore them from backup.

No comments:

Post a Comment