diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 989b41f162..ab70d0c5ba 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -285,6 +285,9 @@ function wp_write_post() { // Create the post. $post_ID = wp_insert_post( $_POST ); + if ( empty($post_ID) ) + return 0; + add_meta( $post_ID ); // Reunite any orphaned attachments with their parent diff --git a/wp-admin/post.php b/wp-admin/post.php index 8f3574f278..f083686624 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -38,6 +38,9 @@ case 'post': if ( isset($_POST['save']) ) $location = "post.php?action=edit&post=$post_ID"; + if ( empty($post_ID) ) + $location = 'post-new.php'; + wp_redirect($location); exit(); break;