In this article I'm going to talk about WordPress revisions and why you might possibly want to limit or disable the revision history of your WordPress pages and posts.
 
WordPress provides revision control on any pages or posts that you create which allow you to go back and see previous edits that you've written over in the database. While this can seem like a great thing to have, over time it can lead to a lot of unessary overhead in your WordPress database.
 
For instance let's say that you've previewed a post that you've been working on 7 or so times, each of those revisions you might have just changed around a word or two, or made some very minimal changes. However in the WordPress database you would now have 8 copies of your original post, the 1 main one and 7 revisions storing the full content of that past revision and not just the changes made since the last one. 

Limit WordPress revisions

Using the steps below I'll show you how you can limit the number of revisions that WordPress will store per page or post. By default there is no limit on the amount of revisions so any limit you impose is going to help keep your WordPress database more efficient. We'll be using the WP_POST_REVISIONS setting in our wp-config.php file to accomplish this.

In this example we're going to set our max amount of revisions per page or post to 3. So in total there will be 4 entries in the database per page or post, 1 for the original itself, and then the 3 latest revisions. In this case I simply started a new post with the title Test and then in the content of the post I simply entered in Test #1 and then previewed the page, then I entered Test #2 and previewed the page again up until I got to Test #7.

  1. Login to your cPanel.
  2. Access the cPanel File Manager Code Editor and navigate to your wp-config.php file.
  3. Enter in the following code towards the top of the wp-config.php file:

    /* @package WordPress
    */

    define('WP_POST_REVISIONS', 3);

    // ** MySQL settings - You can get this info from your web host ** //

    After that click on Save Changes at the top-right.

    Below is a screen shot of the WordPress database showing the difference between the default WP_POST_REVISIONS settings, and the ones we just set.

    wordpress database showing wp_post_revisions difference

Disable WordPress revisions

In the steps below I'll show you how to completly turn off WordPress revisions for your pages and posts. Again we'll be using the WP_POST_REVISIONS setting in your wp-config.php file to make these changes.

Also again I've done the same thing where I created a new post called Test, and then I put Test #1 as the content and previewed the page, then I changed the content to Test #2 and previewed it again. I repeated these steps till I got up to Test #7

  1. Login to your cPanel.
  2. Access the cPanel File Manager Code Editor and navigate to your wp-config.php file.
  3. Enter in the following code towards the top of the wp-config.php file:

    * @package WordPress
    */

    define('WP_POST_REVISIONS', false);

    // ** MySQL settings - You can get this info from your web host ** //

    After that click on Save Changes at the top-right.

    Below is a screen shot of the WordPress database that no revisions are being stored, and only 1 row is being used for my post.

    wordpress database showing wp_post_revisions off

You should now understand how to limit or completly disable the WordPress revision functionality to help keep your WordPress database optimized. If you already have a large amount of pages and posts that have a lot of revisions we would recommend possibly trying out the Better Delete Revision WordPress plugin, while this plugin is old it still functions perfectly fine from the testing that we've done.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question
n/a Points
2014-09-03 2:21 pm

When I applied the code provided above and attempted to access my site I got an error pointing directly to the line containing;

* @package WordPress

 

Staff
17,293 Points
2014-09-03 3:04 pm
Hello James,

Thanks for the question. The problem has to do with a missing slash in the code above. The first part is supposed to be a comment. It's missing a slash. So when you copied it, the comment doesn't work correctly. You can either remove the section with the asterisks, or add the '/' that supposed to be in front of the "*". The code should look like this:

/* @package WordPress
*/

define('WP_POST_REVISIONS', false);

// ** MySQL settings - You can get this info from your web host ** //


I will also correct the code used above. Sorry for the confusion!

Regards!
Arnel C.
n/a Points
2014-09-28 10:05 am

you didnt correct the code

Staff
19,427 Points
2014-09-28 11:26 am
Hello Phred,

To what code are you referring? Are you not having any luck with implementing one of the above solutions?

Kindest Regards,
Scott M

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

4 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!