diff --git a/includes/classes/DistributorPost.php b/includes/classes/DistributorPost.php index ce440013e..a19b67f6b 100644 --- a/includes/classes/DistributorPost.php +++ b/includes/classes/DistributorPost.php @@ -782,6 +782,9 @@ protected function post_data() { 'excerpt' => $this->post->post_excerpt, 'parent' => ! empty( $this->post->post_parent ) ? (int) $this->post->post_parent : 0, 'status' => $this->post->post_status, + 'date' => $this->post->post_date, + 'date_gmt' => $this->post->post_date_gmt, + 'distributor_media' => $this->get_media(), 'distributor_terms' => $this->get_terms(), 'distributor_meta' => $this->get_meta(), @@ -864,6 +867,12 @@ protected function to_insert( $args = array() ) { $insert['post_status'] = $args['post_status']; } + if ( 'future' === $insert['post_status'] ) { + // Set the post date to the future date. + $insert['post_date'] = $post_data['date']; + $insert['post_date_gmt'] = $post_data['date_gmt']; + } + // Post meta used by wp_insert_post, wp_update_post. $insert['meta_input'] = array( 'dt_original_post_id' => $post_data['distributor_original_post_id'],