Get more control over post revisions

In WordPress 2.6, revisions where introduced. Now, whenever you write a post or a page, WordPress will save a revision of your article. This is a great feature which will save you if your browser or computer crashes unexpectedly. Everything you had written would be saved in a database and WordPress would tell you about the saved content from where you can continue.

Revisions can also help you see the changes in your articles. For example, if one author has written an article one day, and decided to make changes on the other one, you are still able to see the first version of the article. Also, WordPress will give you the ability to compare revisions of your article simply by moving a slider left and right. By doing that you will be able to see what has changed and WordPress will even highlight the changes.

Control Post Revisions

But, no matter how helpful revisions can be, if you have a lot of posts and pages, you will have much more revisions of them. Although revisions won’t slow down your site since they’re called only for the post you’re editing, some people like to keep their databases clean or maybe you don’t want to use revisions in the first place. This is where you can tell WordPress not to keep revisions or you can limit their numbers.

In this article, we’re going to show you how to do that manually by entering new commands into WP’s core files. If you prefer using a plugin, you will be interested in using one of these.

Disable revisions:

  1. Open wp-config.php
  2. Add the following line to the file:
  3. define('WP_POST_REVISIONS', false );
  4. Save changes

Limit revisions:

  1. Open wp-config.php
  2. Add this line of code at the end of the file where the last number represents the number of revisions you want to keep:
  3. define('WP_POST_REVISIONS', 3);
  4. Save changes

Delete existing revisions:

  1. Open Phpmyadmin
  2. Go to SQL options
  3. Run the following query where “2015-04-01 00:00:00” represents the date after which all revisions will be deleted:
DELETE FROM wp_posts WHERE post_type = "revision" AND post_modified < "2015-04-01 00:00:00";

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

Your email address will not be published. Required fields are marked *