I have seen a lot of “turn of auto-save or clutter up your database”-type comments lately claiming the auto save function in WordPress will waste a lot of space in the database. In reality, this is not the case.
It seems like there is a common misconception amongst some WordPress users that for each auto save event, a new copy of the current post is stored in the database. This is not true. When WordPress first auto saves the current post you are working on, a new row is used in the database. After this, every subsequent auto save will overwrite this very same row. So at all time, only one row in the database is used by the auto saves function.
By default, WordPress has auto saves enabled and set to save every 60 seconds. You can change this behavior by defining the AUTOSAVE_INTERVAL constant in you wp-config.php file. This can be done in other files as well, but since this setting defines how your WordPress installation should behave, maybe that is the best place to put it.
To change the rate of auto saves you define the AUTOSAVE_INTERVAL Â in seconds:
If you would like to disable it, set the number of seconds to an extremely high value like:
define('AUTOSAVE_INTERVAL' 86400); // One day
There are a lot of examples on the Internet where people are using the follow snippet:
THIS IS A BAD IDEA! It actually breaks functionality in the âNew postâ page of WordPress. This script is needed to initially save the post when you leave the Title field and hence generating the permalink.
A related function in WordPress is the revision management. By default each post can have an unlimited amount of revisions. New revisions are created each time you save your post. This function is always a lifesaver if you happen to remove something you previously had written or when your web browser or computer crashes.
By default, WordPress has auto post revisions enabled and the amount of post revisions set to âunlimitedâ. You can change this setting by defining the WP_POST_REVISIONS constant in your wp-config.php.
It can have three different values:
- True or -1: Store all post revisions (default).
- False or 0: Do not store any post revisions except the one used by auto save.
- (int) > 0: Stores that many post revisions +1 for auto saves.
This example will store 3 post revisions +1 for the auto saves functionality:
Do you need all revisions?
In most cases, the auto save functionality and post revisions is a good thing to have. But do you actually need an unlimited amount of post revisions? Post revisions will actually decrease the overall performance of WordPress, if there are A LOT of them. I personally prefer to have three post revisions stored in my database and the auto saves functionality enabled for those times when technology fails.