Ensure edit_post() promotes an auto-draft to draft. Fixes Quick Draft.

Merges [28073] from the 3.8 branch to the 3.7 branch.

props dd32.
see #27734.

Built from https://develop.svn.wordpress.org/branches/3.7@28074


git-svn-id: http://core.svn.wordpress.org/branches/3.7@27905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-04-11 04:38:11 +00:00
parent 1dd3b9212e
commit 1f7cf009b3

View File

@ -203,10 +203,6 @@ function edit_post( $post_data = null ) {
_wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_ID ) );
}
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' :
@ -227,6 +223,10 @@ function edit_post( $post_data = null ) {
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'] );