I've always used this:
function disableAutoSave(){
wp_deregister_script('autosave');
}
add_action( 'wp_print_scripts', 'disableAutoSave' );
but in WP 3.3 (Debug On) it throws:
Notice: Undefined index: autosave in /{path}/wp-includes/class.wp-scripts.php on line 158
Notice: Trying to get property of non-object in /{path}/wp-includes/class.wp-scripts.php on line 158
What's the correct implementation?
Dale Sattler
Member
Posted 5 months ago #
Workaround it with?
define('AUTOSAVE_INTERVAL', SOME_LONG_TIME_PERIOD);
Thanks but no. I wish to disable it.
Not sure if this method still works, but it did last time i tried it.
function hacky_autosave_disabler( $src, $handle ) {
if( 'autosave' != $handle )
return $src;
return '';
}
add_filter( 'script_loader_src', 'hacky_autosave_disabler', 10, 2 );
Simply wipes out the src value for the autosave script, which in essence stops the auto saves(or did last time i tested it in 3.0).
Many thanks, I'll give it a go.
Egill R. Erlendsson
Member
Posted 4 months ago #
Throw this in your functions.php
add_action( 'admin_init', 'disable_autosave' );
function disable_autosave() {
wp_deregister_script( 'autosave' );
}