Skip to content

Commit

Permalink
Never update the post status when updating a post.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Nov 22, 2023
1 parent 2bba959 commit ee56b99
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/classes/DistributorPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,14 +860,16 @@ protected function to_insert( $args = array() ) {
if ( ! empty( $args['remote_post_id'] ) ) {
// Updating an existing post.
$insert['ID'] = (int) $args['remote_post_id'];
// Never update the post status when updating a post.
unset( $insert['post_status'] );
}

if ( ! empty( $args['post_status'] ) ) {
} elseif ( ! empty( $args['post_status'] ) ) {
$insert['post_status'] = $args['post_status'];
}

if ( 'future' === $insert['post_status'] ) {
if (
isset( $insert['post_status'] )
&& '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'];
Expand Down

0 comments on commit ee56b99

Please sign in to comment.