Skip to content

Commit

Permalink
Include date when pulling scheduled posts.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Nov 21, 2023
1 parent 8e46f93 commit 725b9f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions includes/classes/DistributorPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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'],
Expand Down

0 comments on commit 725b9f2

Please sign in to comment.