Have you notice that WordPress saves post revisions for you? It is a great utility!
Try it out yourself. Edit a post, click “Update”, and voila, you have Post Revisions!
But sometimes, post revisions can seem to get out of hand. Do you really need or want hundreds of revision histories?
Well, WordPress is here to help you.
First, let me mention that revisions take up space — usually a lot of space. Each revision is held as a separate entity within the database. Therefore, unlimited revisions is usually not a great idea. But having revisions is usually a very good idea, as you may already know.
There are a few settings available to modify how WordPress will be handling revisions for you. They are all contained in the wp-config.php hosted in the main directory of your WordPress instance.
Defining the number of revisions
Revision count is set in the line
define( ‘WP_POST_REVISIONS’, REVISIONS );
Where REVISIONS is
- true or -1: This is the default option in WordPress. WordPress will store every revision of every post
- false or 0: This eliminates all revisions. The only version retained is the most recent saved version.
- Any number greater than 0: This limits the number of revisions to a specific number and automatically deletes all other revisions.
Defining the Autosave interval
WordPress will automatically save posts for you after a defined number of seconds.
define( ‘AUTOSAVE_INTERVAL’, SECONDS ); // Seconds
Where SECONDS is interval at which an autosave will occur.
A word of warning.
Optimally, you may think that setting AutoSave to a very low number of seconds is the best! This would mean that even if the power goes out or the Internet becomes unavailable, you haven’t lost any work. And this is true!
But consider this also, each version that is AutoSaved potentially takes a lot of space. This might not be optimal.
So then you might consider, okay, just make the REVISIONS a reasonably low count, and your site will be fine again! Well, maybe. Consider it this way. If REVISIONS is set to say 15 (which sounds like a reasonably high number), and AutoSave is set to 60 (seconds), then regardless of whether you have explicitly saved a copy of the page, the revision history disappears after fifteen minutes.
That might not be optimal for you.
I don’t have a magic answer for you here, other than to say, be aware. For me, I’ve set my AUTOSAVE to 120 seconds (I normally save more often than this). and I’ve set my REVISIONS to 50. In my case, I’m running my own server farm, and I have potentially unlimited database space, so retaining many revisions is not a big deal. Your situation may be different.