WordPress Autosave

What are WordPress autosaves?

WordPress autosaves are snapshots of your content that are automatically saved to your database every 60 seconds (although this can be customized). Autosaves are similar to WordPress revisions in that they contain a backup of your content.

If you’ve ever seen this message when you open up a post or page to edit it…

There is an autosave of this post that is more recent than the version below. View the autosave.

…that means a WordPress autosave might contain some content that would have otherwise been lost. You might want to check the autosave version to see if it’s more up-to-date than your current revision.

Autosaves vs. Revisions

There are some important differences between the two:

  • Autosaves do not overwrite the actual post. They are stored independently of all your other drafts.
  • Autosaves are created automatically, without the need to click “Save Draft” or “Update”.
  • Only 1 autosave is stored at a time; newer autosaves overwrite older ones.
  • There is only ever 1 autosave per user per post.
  • Autosaves are clearly marked as such when viewing all your revisions.

Here’s another way to understand the difference between autosaves & revisions:

Autosaves Revisions
Only 1 autosave is stored per user per post. New ones overwrite old ones. You’ll never have more than 1 autosave. Many revisions of the same post can be stored for the same user. You could have 100+ revisions for the same post.
Created automatically. No action is required. Created each time you click “Save Draft,” publish a new post, or click “Update” on a post.

SEE ALSO: How to disable/limit WordPress revisions

Autosave Interval

The autosave interval is the amount of elapsed time before each autosave is taken. By default, WordPress overwrites a post’s autosave every 60 seconds.

What’s a good autosave interval?

It depends on your situation.

If you have fast WordPress hosting (we recommend Kinsta), and you write often, 60 seconds is adequate. For extra piece of mind, you could even lower that to 30 seconds. I probably wouldn’t go any lower than that. Creating autosaves requires writing to your database, and to do this every XX seconds while you write could slow down your experience.

If you are on shared hosting, have a slower server, are on a reliable internet connection and not too worried about your browser or computer crashing… you might want to increase your autosave interval to 5 minutes or so.

How to change the WordPress autosave interval?

There are essentially two ways to change the autosave interval:

  • free method, using code
  • use a premium plugin, Perfmatters

Free: Update wp-config.php file

NOTE: If you don’t know how to locate your wp-config.php file, you probably shouldn’t be editing it. Either ask a WordPress developer to help you, or use the Perfmatters plugin instead.

Add the following line to your wp-config.php file:

// Change Autosave Interval
define( 'AUTOSAVE_INTERVAL', 300 ); // 300 seconds = 5 minutes

This code must be placed above the line that says, “That’s all, stop editing!”.

You can change the 300 to any number you’d like. This number has to be in seconds.

  • 120 = 2 minutes
  • 180 = 3 minutes
  • …and so on

Use the Perfmatters Plugin

The Perfmatters plugin is a lightweight WordPress performance plugin designed to speed up your site. And one way to do that is by extending the WordPress autosave interval.

  1. Purchase & install Perfmatters
  2. Navigate to Settings > perfmatters
  3. Look for Autosave Interval
  4. Choose your preferred interval
  5. Click Save Changes at the bottom