I wanted to clamp the edits on one of my WordPress blogs recently, and decided to use the trusty old WP_POST_REVISIONS entry, where you add the following to wp-config.php:
…Somewhere before the require_once function:
Sounds good right?
It didn’t work.
A quick check on the forums assured me of two things:
- I wasn’t alone in having this issue.
- A lot of people were annoyed (VERY ANNOYED) by this failure.
Basically, if you use a number like 3 it clamps – SHOULD CLAMP – revisions to a maximum of the last 3 (plus any autosaves) – and if you use false like this:
No edits are saved.
Trying options, I hit on what I think is the problem – Revision Control.
Simply put, if you have an old post with revisions already, adding this entry doesn’t always make them disappear automatically from the database, or clean them up (although it might hide them from view – just remove the entry and they pop back again).
Here’s the kicker: Repeatedly saving copies so as to ‘trigger’ cleanup won’t work either, UNLESS YOU CHANGE THE TEXT. Revision control doesn’t see a new copy unless there are changes, so cleanup is not triggered. Change a letter or two, save it, and old entries are finally trashed.
- Add the WP_POST_REVISIONS entry to your wp-config.php file.
- Go to any article you want trimmed.
- Change something in it and save.
- Change it back and save (unless you like the changes).
Of course, if you have lots of posts with revisions, heave a sigh, and leave them be – the effort to revise each and every one is simply not worth it. Frankly, I think WP should come with the entry already in wp-config.php, and set to something like 5 or 10 by default – better yet, a configurable setting in Admin to change it AND clean up the database would work well…