Better autosaving in WordPress

I know WordPress comes baked with auto saving capabilities and it can be customised using the wp-config.php file.

But is there a better way to achieve auto saving in posts in WordPress? Sometimes WordPress native autosave functionality is a little too cumbersome for an average computer user.

Think about Google Docs and how it handles autosave. Is there a plugin or a way to achieve (or come close to) that level of non-intrusive auto saving that just keeps saving the changes by its own?

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi, RB!

    I don’t know of a way to bypass the built-in autosave function in WordPress and replace it with another, and a quick search did not reveal any alternatives. Rewriting it in WordPress core would be both very challenging and ill-advised. (WP is always backward compatible.)

    Can you explain how the default autosave is too difficult for typical users? It usually works quietly behind the scenes, it shouldn’t take intervention unless you’re trying to optimize your server resources by decreasing the interval between saves. Are you speaking about the brief wait while the post is autosaving? It can pause the action for a fraction of a second, but I’ve never found it terribly cumbersome on my own sites. Reducing the interval can help, here, and it’s not a terribly complex edit to add. Defines you add to wp-config aren’t overwritten when WordPress core updates, you can do them once and forget about them. This is the line you need to add, right above the line that tells you to stop editing.

    define('AUTOSAVE_INTERVAL', 120 );

    That number is in seconds, on my production site I have mine set to 300 seconds, or every five minutes. The default is 60 seconds. That’s it, it’s one of the easier WP hacks to do, even for a newbie. :slight_smile:

    Hope this helps!

  • Sajid
    • DEV MAN’s Sidekick

    Hi RB! Hope you are well today and had a great weekend :slight_smile:

    If you set the interval 15 or 30 seconds then it will auto save after 15 or 30 seconds. WP will send server request each time it will save changes. If you are writing a blog post that will take 30 to 45 minutes (a lot more in most cases) and you have set 15 as interval, then WP will send 120 to 180 requests (each post).

    So it does not seems to be crazy though or pretty resource intensive for server :slight_smile:

    But I recommend you don’t set lowest interval for server compatibility and performance.

    Cheers, Sajid

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.