How to Delete Post Revisions in WordPress

Delete WordPress Post Revisions

What type of questions comes into the mind when you read the title of this post? I believe below questions come into the mind of every blogger just like me when they read the title.

What are post revisions in WordPress?

What they do with our database?

And finally


How to get rid of them from WordPress?

Here is the answer of all the above questions.


What are post revisions in WordPress?

When you update an article, it automatically creates a copy of your post as a revision into the database so that in future you can recover from the older revisions, if required. Auto-saves and save draft also create a revision copy of your post.

What they do with our database?

They create so many copies of your posts as a revision and increase the size of your database. Let’s take an example:

Suppose you have created 200 posts and we assume you have saved / auto save 5 times on an average to each post. Now the total posts will be 1000 into the database that will increase the size of database 5 times from the actual size.

Due to heavy update, many no of revisions are created and then affect the performance of the database.

How to get rid of them from WordPress?

There are many methods to delete post revisions from the database. You can add WordPress Plugins to do it. If you don’t want add a Plugin then follow below steps to get rid of post revisions.

Step-1:

First login to MySQL database using phpMyAdmin in your panel.

Step-2:

Select the MySQL database and take a backup.

Step-3:

Now issue the following command to purge all the revisions posts from database.

DELETE FROM wp_posts WHERE post_type = ‘revision’;

This command will delete all your post revisions from MySQL database.

Step-4:

Once you deleted, you will no longer be able to compare the differences between your post revisions.

Step-5:

If you don’t want to create revisions in your future posts then add the following line in your wp-config.php file.

define(‘WP_POST_REVISIONS’, false );

If you want 3 revisions of your post then following command will help you:

define(‘WP_POST_REVISIONS’, 3 );

You can change no of revisions according to your need.

Get Free Blogging Tips & Technology updates in your Email !!!

Subscribe via RSS feed

The following two tabs change content below.
Anil Kumar
IT Blogger Tips focus on Blogging Tips, SEO Tips, Social Media, SQL Tips, PL/SQL Tips, Oracle DBA, Linux/Unix, Latest Technology, How Tos and Technical Solutions. You can find us on Facebook | Twitter |
Find on Google+

Siteground SALE
60% OFF SiteGround WordPress Hosting – $3.95/month (Exclusive Offer !!!)