You are currently viewing Disable autosave in WordPress posts using code

Disable autosave in WordPress posts using code

In this article, I’ll explain how you can disable autosave in WordPress posts using code. To disable autosave in WordPress using code, you can use the following snippet:

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

To use this snippet, you can add it to your theme’s functions.php file or create a custom plugin.

Alternatively, you can also disable autosave by adding the following line of code to your wp-config.php file:

define( 'AUTOSAVE_INTERVAL', false );

/**Or you can you this snippest to add some time on auto save**/

define('AUTOSAVE_INTERVAL', 86400);

This will disable the autosave feature for posts in WordPress. Note that this will not affect the autosave feature for pages. To disable autosave for pages, you can use the same code snippet or wp-config.php line, but in a custom plugin or functions.php file that is specific to pages.

Join us on Facebook

See the samples of WordPress website

Leave a Reply