How To Change The WordPress Autosave Interval

WordPress is an open source Content Management System (CMS) that makes it easy for you to publish and maintain a website without a lot of technical skills.

It has all the options to change different aspects of your WordPress site. While you are writing a post, WordPress saves it automatically as a draft every 60 seconds. WordPress uses AJAX to autosave post revisions to your database as you edit the page/post.

This is a handy feature when you forget to save your posts while updating your site.

There are certain situations when you want to change the WordPress autosave interval. In this guide, you will learn to change the default WordPress Autosave Interval feature.

Prerequisites

  • A Domain Name (example.com)
  • WordPress Admin Credentials
  • cPanel Credentials
  • FTP client (Filezilla, Cyberduck)
  • Text Editor (Notepad, Sublime)

Step 1:

Login into your cPanel using your username and passwordHow To Change The WordPress Autosave Interval

Locate File Manager and Click on File Manager to access your website directory. You can also use an FTP Client to access it.

Inside you website directory, click on public_html from the left side menu and locate the wp-config.php file.How To Change The WordPress Autosave Interval

How To Change The WordPress Autosave Interval

Step 2:

Right click on the wp-config.php file and Click Edit. A pop-up window will appear. Click Edit to open the editor. If you are using FTP client, you need to download that file and open it with your favorite text editor.

Step 3:

How To Change The WordPress Autosave IntervalHow To Change The WordPress Autosave Interval

Search for the following piece of code in your wp-config.php file

require_once(ABSPATH . 'wp-settings.php');

Now, add the following line of code before the above code.

define('WP_POST_REVISIONS', 4);define( 'AUTOSAVE_INTERVAL', 20 );

In the above line of code, 20 represents the autosave interval time in seconds. Change the interval time as required by adding the number of seconds you want to add. The first line tells WordPress to save only 4 post revisions of any article.

Now, Click on Save Changes from the top right corner. Before saving, make sure the above line of code is added before the first line of code. Note that you need to enter the duration in seconds and not minutes.

Step 4:

To check, if the interval time has been updated or not Login to your admin Dashboard. Click on Posts and Click Add New. Start writing your post and observe the autosave interval.

Step 5:

You can also disable autosave feature if you want to save your changes manually. Add the following lines of code to the functions.php file to disable it. Go to your admin dashboard and click on Appearance on the left side menu.

Click on Editor to open the editor. From the right side in the Editor window, click on functions.php. Add the following lines of code to it.

functiondisable_autosave() {
wp_deregister_script('autosave');
}
add_action('wp_print_scripts','disable_autosave');

Click on Update File and see the changes while you are writing your posts.

Conclusion:

By following the above steps, you have learned how you can change the autosave interval time of your WordPress site and also disable it if you do not want that feature.

Check out these top 3 WordPress hosting services:

Was this article helpful?