Description: Ensure edit_post() promotes an auto-draft to draft.
 Fixes Quick Draft
Origin: upstream, https://core.trac.wordpress.org/changeset/28073
Bug: https://core.trac.wordpress.org/ticket/27734
--- a/wp-admin/includes/post.php
+++ b/wp-admin/includes/post.php
@@ -194,10 +194,6 @@
 			wp_die( __('You are not allowed to edit this post.' ));
 	}
 
-	if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) {
-		$post_data['post_status'] = 'draft';
-	}
-
 	if ( isset($post_data['visibility']) ) {
 		switch ( $post_data['visibility'] ) {
 			case 'public' :
@@ -218,6 +214,10 @@
 	if ( is_wp_error($post_data) )
 		wp_die( $post_data->get_error_message() );
 
+	if ( ( empty( $post_data['action'] ) || 'autosave' != $post_data['action'] ) && 'auto-draft' == $post_data['post_status'] ) {
+		$post_data['post_status'] = 'draft';
+	}
+
 	// Post Formats
 	if ( isset( $post_data['post_format'] ) )
 		set_post_format( $post_ID, $post_data['post_format'] );
