How To Make Money With Your Blogs!

BlogForumManagerReportsVideosPluginsDownloadsFAQHelp

Revision Control In WordPress - Or, How To Keep Your Database Small

by David Pankhurst - November 29, 2008

I’m going to let you in on a secret - if you are editing and reediting posts on your blog, you’re keeping revision copies of EVERY change you make!

For example, I often save a psot, then edit it later, and save again. Sometimes, I’ll make a change or two just because of spelling, and then save it.

I like saving - a lot - but every time I press that ‘Save’ button, I get a new copy of my article (to see them, go to the bottom of the article edit page, and look at the “Post Revisions” item).

In my case, I expect I create 3-10 times the ‘true’ number of posts - and the database has them all!

So while revision control is handy in small doses (say if I ever want to revisit an older post I mistakenly edited), it needs to be limited - and here’s the solution:

  • Edit your wp-config.php file (I recommend keeping a back up copy just in case). Always remember to use an text EDITOR, not a word PROCESSOR (which often mangles text).
  • Add this line around the table_prefix line, like this:
    define('WP_POST_REVISIONS', 2);
    $table_prefix  = 'wp_';
  • Save it.

Now, you will be limited to 2 revisions per article - enough for safety, but not enough to clog your blog’s database.

You can actually tweak the value some more - for example, you can use FALSE or 0 to stop all revision control:

define('WP_POST_REVISIONS', FALSE);

This is handy if your blog is more automated (such as using my utopia17 plugin for article rotating).

And you can use even larger numbers if you want more backup copies of your articles:

define('WP_POST_REVISIONS', 17);

Using this, you can put a cap on your article backups, while still keeping a safety copy or two - and keep your blog’s database performance going well!


ActiveBlogging.com - for information on making your blog successful! Get information like this - and more - inside! Details here or Join Today!

Leave a Reply