WordPress autosave protects your work by saving drafts while you edit. If frequent saves are interrupting your workflow, you can adjust the autosave interval or, in limited cases, disable the Classic Editor autosave script. Increasing the interval is usually the safer choice because disabling autosave can mean losing edits after a browser crash, connection failure, or unexpected logout.
This guide explains the difference between Classic Editor autosave and the Block Editor's recovery features, how to change the interval, and what to know before disabling anything. The examples belong in a small site-specific plugin, a must-use plugin, or your child theme, not in WordPress core files.
Change the WordPress autosave interval
If autosave is happening too often, try increasing the interval before disabling it. Add this filter to a site-specific plugin or your child theme's functions.php file:
/**
* Set the WordPress autosave interval to 5 minutes.
*/
add_filter( 'autosave_interval', function ( $interval ) {
return 300; // Seconds: 300 = 5 minutes.
} );
This changes the interval in seconds. For example, 300 is five minutes and 600 is ten minutes. A longer interval means fewer automatic saves, but it can also mean more recent edits are lost if something goes wrong. Test the change in the editor you use.
Disable the Classic Editor autosave script
Use this only if you understand the risk. This method deregisters the legacy autosave JavaScript used by the Classic Editor. It does not turn off every recovery or autosave feature in WordPress, and it is not a reliable way to disable the Block Editor's full autosave behavior.
To apply it only on post and page edit screens, add this to a site-specific plugin or your child theme's functions.php:
/**
* Disable the legacy autosave script on Classic Editor screens.
*/
add_action( 'admin_enqueue_scripts', function ( $hook ) {
if ( ! in_array( $hook, array( 'post.php', 'post-new.php' ), true ) ) {
return;
}
wp_deregister_script( 'autosave' );
} );
This is a broad switch for those edit screens, not a per-post-type or per-user setting. Confirm that it has the intended effect with your editor and plugins before relying on it. If the Block Editor is in use, keep its autosave and recovery protections enabled whenever possible.
Where should the code go?
- Site-specific plugin: A good choice for functionality that should remain active if you change themes.
- Must-use plugin: Loads automatically and is useful for a small site-wide behavior. Put the PHP file directly in
wp-content/mu-plugins/.
- Child theme
functions.php: Fine when the behavior belongs with your theme. Back up the file before editing.
- WordPress core files: Do not edit them. Core updates can overwrite changes and unsupported edits make maintenance harder.
Limit the number of saved revisions
Autosaves and revisions serve different purposes. If your goal is to limit database growth, consider limiting the number of revisions rather than removing recovery features. Add this line to wp-config.php, above the “That's all, stop editing” line:
define( 'WP_POST_REVISIONS', 5 );
This sets WordPress to keep up to five revisions per post or page. Back up your site before changing configuration, and avoid setting revisions to false unless you have a clear reason and a dependable backup workflow. This setting does not replace database maintenance or backups.
Frequently asked questions
Should I disable WordPress autosave?
Usually, no. Autosave helps recover work after a crash or interruption. If saves are disruptive, try increasing the interval first and keep regular backups.
Does this code disable autosave in the Block Editor?
Not completely. The script deregistration example targets the legacy Classic Editor autosave script. The Block Editor has its own editor and REST-based save and recovery behavior, so do not assume this snippet disables all of it.
Will the changes survive a WordPress update?
Code placed in a site-specific plugin, must-use plugin, or child theme is not normally overwritten by WordPress core updates. Avoid editing core files directly.
Can I reduce database growth without disabling autosave?
Yes. You can limit the number of revisions with WP_POST_REVISIONS and maintain backups. Autosaves, revisions, and backups have different roles, so one should not be treated as a substitute for the others.