Discover in this tutorial how to change by code how often WordPress saves revisions of posts and pages automatically.
WordPress has an autosaving system that is great for avoiding scares. However, each revision takes up the same space as the article.
So if you have 20 revisions of each post you are increasing the size of the WordPress database considerably, which eventually slows down the loading speed of the web.
You’ve already seen how to limit the number of revisions.
However, there is another parameter you can customize to give you complete control: autosave.
By default, WordPress performs an autosave every 60 seconds.
Do you want to space it out and avoid having versions that are too similar?
You only need one line of code to customize the frequency.
Snippet to change WordPress autosave frequency
Add the following fragment somewhere before the line containing “require_once(ABSPATH….” in the wp-config .php file:
To see this and another 1097 code snippets of this website, login or subscribe here.
From now on, the autosaving of entries and pages will be done every 120 seconds, that is, 2 minutes.
Are you interested in increasing or decreasing this time? Change the number to a more convenient one (always in seconds).
Conclusion
As you can see, with one line of code you can decide how often you want it to auto-save in WordPress.
Also, you can combine this with the limitation of the number of revisions to keep this section of WordPress 100% under control.
If you have any question, please leave it in the comments. And if you want to give me a suggestion for future snippets, please send it through the contact form.
Benefits of being a subscriber. 🙂