Thursday 19 September 2013

3 Ways To Disable WordPress AutoSave

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.

This is my second post of the day here on BWidgets, and it's also about Daniel Bryan wp-config.php file and WordPress AutoPost. This time I'll show you one three ways to disable WordPress AutoSave feature.

When editing a post, the changes you make are automatically saved every 2 minutes. You can also use our last trick to Modify AutoSave Interval.

By Editing wp-config.php File:

This is the easiest way to disable WordPress AutoSave feature. To modify autosave interval simply open wp-config.php (located in root of WordPress installation) and add following code to the end of file:

define('AUTOSAVE_INTERVAL', 86400);

We've set WordPress AutoSave interval to 86400 seconds which is an entire day. So this effectively disables the autosave functionality. Thanks to Jacob Nicholson for the idea.

By Editing post.php File:

This is the smartest way to disable AutoSave feature without any heavy codes. Thanks to Shane G. for sharing this trick on a WordPress forum.

  • Open your wp-admin/post.php file and wp-admin/post-new.php files.
  • You will find this line of code there:

wp_enqueue_script('autosave');

  • Add // to the beginning of this code. It'll look something like this:

// wp_enqueue_script('autosave');

The AutoSave option will be disabled for your existing and new posts.

By Editing functions.php File:

Last but not the least. This is the most preferred way to disable this feature, as we don't have to re-edit our post.php and post-new.php file after every WordPress update, nor we have to adjust AutoSave interval. This trick will simple disable AutoSave feature. Thanks to Egill R. Erlendsson for sharing this trick on a WordPress forum.

Simple throw this in your functions.php file:

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

That's it folks. Thanks for all amazing guys that I mentioned on the article for sharing these amazing tricks around the internet. Don't forget to give us a backlink if you're sharing this article on your blog.
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.