Guide to Changing Autosave Interval in WordPress

Guide to Changing Autosave Interval in WordPress

WordPress is one of the leading content management systems that allows you to manage your website and its content without any coding work.

By default, the WordPress system ships with an autosave feature. When you work on your website, the system automatically saves the changes made every 60 seconds. Behind the scenes, AJAX codes take care of this entire process.

But there might be times where you need to increase the autosave interval. One common reason is to reduce the workload of the server by reducing the number of contacts you make with the server and database.

In this guide, learn how to change autosave interval in WordPress.

The Step-by-Step Process

Here are the steps you need to follow for changing autosave interval:
  • Log in to your cPanel using the correct credentials
  • Navigate into File Manager under the Files section
  • Inside the directory, locate the public_html directory and click on it
  • On the left-hand side panel, find the wp-config.php file
  • Right-click on it and click on Edit to open the file
  • When the confirmation panel opens, click on Edit
  • You need to search for the following line of code:
  • require_once(ABSPATH . 'wp-settings.php');
  • Now just above that code, copy and paste the following code:
Code:
define('WP_POST_REVISIONS', 4);
define( 'AUTOSAVE_INTERVAL', 20 );
In the code you added the autosave interval is set to 20 seconds. Increase it as per your preference. The first line of code instructs WordPress to save four post revision of a post and not more.

Save the changes you made and exit.

To check if the revision interval is set to your preference, edit any post and observe the time it take WordPress to save the changes.

If you want to completely disable Autosave feature, you can do so by opening functions.php file and pasting the following line of code in it:

Code:
function disable_autosave() {
wp_deregister_script('autosave');
}
add_action('wp_print_scripts','disable_autosave');
So that’s how you increase the autosave interval in WordPress. For more assistance, contact the web hosting support team.
Author
kumkumsharma
Views
2,222
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top