diff --git a/wp-includes/post.php b/wp-includes/post.php index 453f45c70e..bf9d7bd13b 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1360,12 +1360,8 @@ function wp_insert_post($postarr = array(), $wp_error = false) { } // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now - if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) { - if ( !in_array($post_status, array('draft', 'pending')) ) - $post_date = current_time('mysql'); - else - $post_date = '0000-00-00 00:00:00'; - } + if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) + $post_date = current_time('mysql'); if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) { if ( !in_array($post_status, array('draft', 'pending')) ) @@ -1534,8 +1530,8 @@ function wp_update_post($postarr = array()) { $post_cats = $post['post_category']; // Drafts shouldn't be assigned a date unless explicitly done so by the user - if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && empty($postarr['post_date']) && - ('0000-00-00 00:00:00' == $post['post_date']) ) + if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && + ('0000-00-00 00:00:00' == $post['post_date_gmt']) ) $clear_date = true; else $clear_date = false; @@ -1544,7 +1540,7 @@ function wp_update_post($postarr = array()) { $postarr = array_merge($post, $postarr); $postarr['post_category'] = $post_cats; if ( $clear_date ) { - $postarr['post_date'] = ''; + $postarr['post_date'] = current_time('mysql');; $postarr['post_date_gmt'] = ''; }