Disable WordPress Autosave


Starting a website and blog has been a very interesting learning experience for me. I’m continually looking for ways to improve the blog and make it more enjoyable. That includes writing good content, and checking the stats at the end of the day.

I’ve noticed recently that the file admin-ajax.php has received a very high percentage of my web views. By the name, I could tell it was from the admin interface, and now I know it is the autosave function that calls a new page every time it saves the current blog post. This meant that when I leave the editing page open for an extended period of time while I’m writing, admin-ajax.php is hammering my web server. This has ruined my web stats, as it skews the data, but I have found a solution.

It turns out that disabling autosave completely isn’t that difficult. If you follow this, you must remember that WordPress will no longer save while you write, meaning you can lose work much easier.

To disable WordPress autosave, you must access your website FTP and edit wp-admin/post.php and wp-admin/post-new.php. In post.php, edit line 102 that says

wp_enqueue_script('autosave');

by adding // to the beginning of the line. In post-new.php, edit line 6 in the same way so it reads

//wp_enqueue_script('autosave');

An example of the actual code is in the photo in this post.

If you ever want to restart the autosave function, just remove the // in both files.

[UPDATE]: I just noticed that autosave is also enabled for creating Pages. To modify the page editor, make the same changes to wp-admin/page-new.php and wp-admin/page.php.

[tags]Wordpress, autosave, website, blogs[/tags]


{ 6 comments… add one }

  • kolt siewerts May 28, 2008, 7:31 am

    Thanks a lot for this find! Safari & autosave were driving me crazy…..
    Peace,
    kolt

  • Ken June 9, 2008, 9:02 am

    Very Useful. But I can’t find any file name “post_new.php” under wp-content directory. I’m sure it’s inside the wp-admin directory also. :)

    Cheers,

    Ken

  • wesg June 9, 2008, 4:26 pm

    @Ken
    Indeed you are correct. That should read wp-admin. The post has been corrected.

  • Neo June 9, 2008, 6:17 pm

    thanks a lot. auto save was a headache for me. it worked on 2.5.1.

  • marius April 8, 2010, 4:01 pm

    thnx very much for this easy trick :)

  • Shelby Thomas September 13, 2010, 1:49 pm

    Hey ! Love your blog.

Leave a Comment

Next Post:

Previous Post: