WordPress has had this feature in its core since version 3.6 (2013), and it is specifically designed to recover at least part of your work in case of human🙃 or technical 🛠️ errors.
Autosave Works by Default
When you make changes to a post, WordPress by default saves those changes in two different places:
⏳ In your browser, every 15 seconds
⌛️ On the server, every 60 seconds
💔 This way, if you have a human error or lose your connection, you will have a copy in your browser of at most the last 15 seconds. If your computer crashes or you clear your browser cache, when you log in again, that copy will be at most from the last 60 seconds.
🤔 How Does This System Work in Practice?
It depends on the case, but let’s focus on the new editor.
🤖 If you start writing a post, it will automatically save the content, even if you don’t click save, just like writing a document in Google Docs.
BUT, from the moment you publish it, you logically won’t want every change you make while editing to be published (this would show changes that might not be finished yet).
📄📄So, to autosave it without publishing, WordPress saves it as a revision, which is a record of all the changes you make to the content.

So, once it’s published, if you make changes and something goes wrong (or you leave without saving them), when you return to the post, you will see a message like this, inviting you to review and, if applicable, restore the autosaved version.


❗️A VERY IMPORTANT detail is that autosave only saves: The title, the main content, and the excerpt.
That is: It will not save selected categories or custom fields (like those added by Yoast SEO at the end of the post).
🧑💻 How Does It Work Technically?
(Also focusing on the new editor).
It does this through the AutosaveMonitor class and the autosave function found in wp-includes/js/dist/editor.js
The AutosaveMonitor class checks, among other conditions, if there have been any changes to the content via the isEditedPostDirty function and triggers autosave, which determines whether it should perform a local or server save at that moment.
💻 If it’s a local save, it calls the localAutosaveSet function, which stores a variable named wp-autosave-block-editor-post-[id] (where [id] is the post ID or auto-draft if it doesn’t have an ID yet) in the browser using window.sessionStorage. The content of this variable is a JSON with the fields post_title, content y excerpt.
☁️ If this save needs to be done remotely, it calls the standard save function savePost, indicating isAutosave: true. This ultimately makes an API call to /wp-json/wp/v2/posts/[id]/autosaves?_locale=user including content, excerpt, status y title
Although, depending on the case, we see it as a revision or not. Technically, it still saves revisions:
- If it’s a draft: the autosave is primary, and the manual save (if old) is a revision.
- If it’s published: the manual save is primary, and autosave is a revision.
Revisions are stored with a new ID in the wp_posts table for that revision, with the post_type revision and linked to the original ID by placing it in post_parent.
🪧Enough with the technical jargon.
💾 Finally, a tip.
If your site has many posts, old revisions are not important, and you want to avoid uncontrolled database growth, I recommend limiting the number of revisions saved in WordPress.
You can do this through a plugin es.wordpress.org/plugins/wp-rev… or by defining the variabledefine(‘WP_POST_REVISIONS’, 10);in wp-config.php, where the number (in this case 10) is the number of past revisions you want to keep (the oldest ones are deleted)