4 thoughts on “How to disable Auto Save in WordPress”

  1. Hi,

    I inserted

    add_action( ‘wp_print_scripts’, ‘disable_autosave’ );
    function disable_autosave() {

    into my website’s (http://top10bestchristmasgiftideas2010.com) ‘functions.php’ file in the theme directory and I’m facing a big trouble now.

    I can’t open my website and there’s this message being displayed:

    Parse error: syntax error, unexpected $end in /home/content/79/6656279/html/wp-content/themes/suffusion/functions.php on line 1563

    Any idea how to fix this?


    1. You have a misplaced ‘}’ so you’ve either put that function inside another function or there is a spare one floating around.

  2. The proper way of making sure autosave doesn’t interfere with your custom meta data is to only run your update and delete functions inside of an if statement. e.g. for a custom post type ‘gallery’:

    add_action(‘save_post’, ‘save_gallery_meta’);

    function save_gallery_meta(){
    global $post;

    if($post->post_type == ‘gallery’){
    //run functions in here

    The save post function is called when autosaving but you should only try to update your custom meta when the post type is your custom post type to avoid running your functions during an autosave. If you run your function during an autosave then the $_POST super global is empty which usually leads to empty meta values.

Comments are closed.