Support & Downloads

Quisque actraqum nunc no dolor sit ametaugue dolor. Lorem ipsum dolor sit amet, consyect etur adipiscing elit.

s f

Contact Info
198 West 21th Street, Suite 721
New York, NY 10010
youremail@yourdomain.com
+88 (0) 101 0000 000
Follow Us

EG-Web

How to disable Auto Save in WordPress

To deactivate Auto Save in all post, simply insert the following code into your ‘functions.php’ file in your theme directory or in your plugin file::

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

If you want to limit it to a custom post type:

add_action( 'wp_print_scripts', 'disable_autosave');
function disable_autosave() {
     if ( ! function_exists( 'get_current_screen' ) )
          require_once(ABSPATH . 'wp-admin/includes/screen.php');

     $screen = get_current_screen();

     if ( is_admin() && ($screen->id == 'post_type_name') ) {
          wp_deregister_script('autosave');
     }
}

Replace ‘post_type_name‘ with your custom post type name.

In the previous code, we checked the current post type by using the function get_current_screen.

Note: we also checked if the function get_current_screen exists or not; otherwise you will have to require it once using:

require_once(ABSPATH . 'wp-admin/includes/screen.php');