Revision Control In WordPress – Or, How To Keep Your Database Small
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!









Does this handle page revisions too? And, if not, is it correct to say that adding an additional line with ‘WP_PAGE_REVISIONS’ replacing ‘WP_POST_REVISIONS’ either above or below the post revision line and giving a maximum number of page revisions to the page revision integer is how to add this control?
Yes, it handles pages and posts both – one setting for all.
This was working properly until I recently upgraded wordpress to 3.2. Any idea why stopped working? Now my database is full with all kind of silly revisions that I never need and don’t know how to stop it. It is very annoying.
Check your .htaccess file – as long as it’s in there, it should work, since I’m using 3.2 w/o problems.
Leave your response!
What IS ActiveBlogging?
Click here for more details
Great Deals On WordPress Plugins!
• Easy Ad Blocks Plugin - Click Here.
• Easy Blog Popups Plugin - Click Here.
• Fading Ads Plugin - Click Here.
• Easy AutoPoster Plugin - Click Here.
• Easy Affiliate Links - Click Here.
• Easy 'TinyURL' Links Plugin - Click Here.
• Automatic Comment Killer - Click Here.
• Easy Social Rankings Plugin - Click Here.
• Easy Split Tester - Click Here.
Latest Issue
Categories
Other Sites
Pages
Members
Archives
Special Offers
Click Here for details.
Recent Posts
Most Commented
Recent Comments