Skip to content

Commit

Permalink
Merge pull request #956 from 10up/fix/700-relink-changes-date
Browse files Browse the repository at this point in the history
Retain the publishing date when updating posts.
  • Loading branch information
peterwilsoncc authored Jan 8, 2023
2 parents 15708c0 + e4c6199 commit e072514
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public function push( $post_id, $args = array() ) {

// Setting the ID makes `wp_insert_post` perform an update.
$new_post_args['ID'] = $args['remote_post_id'];

// Do not modify the publishing date of the post.
$new_post_args['post_date'] = get_post( $args['remote_post_id'] )->post_date;
$new_post_args['post_date_gmt'] = get_post( $args['remote_post_id'] )->post_date_gmt;
}

if ( empty( $args['post_status'] ) ) {
Expand Down

0 comments on commit e072514

Please sign in to comment.