Support » Plugins » Hacks » how to disable autosave in WP3.3 ?

  • I’ve always used this:

    function disableAutoSave(){
    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?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Workaround it with?


    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.

    Throw this in your functions.php

    add_action( 'admin_init', 'disable_autosave' );
    function disable_autosave() {
            wp_deregister_script( 'autosave' );

    Word of warning: You should never disable the ‘autosave’ function like this.

    Because it will ‘break’ the preview function for posts.

    Instead edit your wp-config.php to contain the following:

    define('AUTOSAVE_INTERVAL', 86400 ); // seconds (Default: 1 day)

    Put the interval time as long as you want.

    i disagree, if you disable autosave and then click preview it still creates a revision… the purpose for me is to completely eliminate revisions from getting created on my custom post type. but thats Egill for the disable script.

    @sethmatics – Are you agreeing with Egill’s solution? We need to turn off autosave due to users who open up tabs and tabs of the same edit page and causing confusion.

    well, for 1 I thought that the edit lock solves your problem. you may want to research the post edit lock functionality in wordpress.

    next, I am agreeing that Egill’s solution properly disables the autosave feature. I am, however, only adding the disable script when on edit pages of my custom post types. FlashUK is correct when he says that disabling autosave also disables the “preview” functionality, so if you need to be able to preview your changes before you publish, then you need to define a long term interval as he suggests.

    The the answer is, depends on what you need. Sounds like FlashUK’s solution is better for you.

    Thanks. It worked.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to disable autosave in WP3.3 ?’ is closed to new replies.