How to Disable (or Modify) the Revision History in WordPress

For some reason, WordPress maintains the revision history for posts in the same database as the live posts. The issue with having the revision posts in the database is the extra overhead. Whenever the website queries the database, it needs to work with all records—including the revisions. Of course, this will unlikely be a problem for most blogs. But for those who prefer to keep websites running as efficiently as possible, the number of revisions can be limited…or stopped altogether.

Before continuing, it should be mentioned that this post is based on a WordPress.org installation of the blogging solution. I'm unfamiliar with controlling the revision history for WordPress.com hosted blogs. Also, note that there are plug-ins available for dealing with the revision history.

How the Revision History Works

For blogs (or websites) with the revision history enabled, WordPress creates a single database entry for each new post. Then, every time the save, publish, or update buttons are clicked, WordPress creates a separate database entry for the previous version of the post.

When hearing about the revision history, I was immediately concerned about this blog (CyberScorpion Bytes). Given my prior experience with computers and losing data from not saving enough, I constantly click the save button. It wouldn't be surprising if I click the save button a few dozen times while writing a post.

Well, depending on how the blog is set up, we could be looking at hundreds of database entries for a single post. However, for the two blogs I'm working with, one had the revision history disabled. The other limited the number of revision entries to 10.

Limit / Disable the Revision History

According to the WordPress Codex, adding the following line of code to a blog's wp-config.php file will prevent revisions from being stored:

define('WP_POST_REVISIONS', false);

Keep in mind that the change won't affect revision entries created prior to the code being added. For those not wanting to eliminate the revision history altogether, the "false" part could be changed to the maximum number of revisions we want to maintain. For example, to have WordPress track up to 10 revisions, the code would be changed to:

define('WP_POST_REVISIONS', 10);

Note that if WP_POST_REVISIONS is already defined in the wp-config.php file; modify the existing entry instead of adding a new one.

Conclusion

While it would be nice if WordPress stored the revision history in a separate database, at least there's an option to customize how many entries are stored. If there isn't a need for the revision history, it can be disabled. We just need to modify the settings file.

0 Comments

There are currently no comments.

Leave a Comment