Site icon WP Smith

Disable AutoSave on Add New Post Admin Page

Disabling revisions won't stop WordPress from creating the initial draft version of a custom post type. So I used this snippet to accomplish this as well.

<?php
add_action( 'admin_enqueue_scripts', 'wps_cpt_admin_enqueue_scripts' );
/**
* Disable initial autosave/autodraft
*/
function wps_cpt_admin_enqueue_scripts() {
if ( 'cpt' == get_post_type() )
wp_dequeue_script( 'autosave' );
}