Disable Post Revisions in WordPress to Better Loading Time

WordPress offers a nice feature in storing versions of your posts. It controls your versions, and helps you bring back one of the previous copies of your article if you ever find a need for it. Application will generally be for lengthy posts that go under plenty of revisions, especially when multiple people are involved. And, for articles that go under the review board.

This nice-to-have feature is a bane for websites that boast of several thousand posts. The database gets inflated at least by two times, and slows down loading of the website by a considerable amount.

I own an article directory on the root of this domain. Last month, it reached close to 50,000 posts. The database staggered for a long long time before it showed life. The total number of revisions per post was 1.7, and that equated to around 85,000 posts. The loading time was around 5.5 seconds on a sample article that I picked to test the effect of inflated database. I duly disabled post revisions and ran a query on my database to expunge the old revisions. Load time on the same sample article reduced to 4 seconds. That’s big considering the patience of a web user is wafer thin.

Right, so getting rid of post revisions help, especially if you run big websites. On the other hand, there are disadvantages ebbing from taking them out completely as well. Think long and hard before you decide on the future course of action.

Disable Post Revisions Completely

If you have made up your mind to completely take out the post revision feature from your WordPress installation like I did, add the following line in wp-config.php after the

define(‘WP_POST_REVISIONS’, false);

Delete all Existing Post Revisions in WordPress Database

As I mentioned earlier, I had to remove around 35,000 posts from my database. I used this query, and it worked like a charm.

DELETE FROM wp_posts WHERE post_type = ‘revision’

Control Post Revisions through Revision Control Plugin

Suppose you don’t want to take the extreme step of disabling post revisions but would want to play it safe by limiting the number of revisions, Revision Control plugin is your friend. It gives you the flexibility to limit the number of revisions, globally as well as post level. Your editor can proof read and save the article as a later version, and if you need to get back your old one for review, it is available at a mouse click.

ps : I finally decided to create a new database and start a fresh website on my article directory. The decision was taken after I realized that I was spending far too much time on an activity (approving articles) that adds no to almost nil value.