Disabling autosave

You may already know, custom post types are the real workhorses of most customized WordPress themes. But often, they’re not meant to be read by the public; they’re functional things like ‘albums’ or ‘reservations’ or ‘index cards.’ By default, WordPress tries to create auto-drafts of any post type when an author is adding / editing through the admin panel, and this may not be welcome. Auto-drafts may at best add unwanted clutter, at worst screw up your organizational system.

Here’s a snippet (stick it in your ‘functions.php’ file) that disables autosave for anything that’s not a post or page:

add_action( 'admin_enqueue_scripts', 'bdes_admin_meta_scripts' );
function bdes_admin_meta_scripts( $hook ) {
	$post_type = get_post_type();
	if ( ! $post_type ) $post_type = $_REQUEST['post_type'];
	if ( $post_type != 'post' &&  $post_type != 'page' ) wp_dequeue_script( 'autosave' );
}