Skip to content

Commit

Permalink
Fix #621 (#677)
Browse files Browse the repository at this point in the history
* Update class-follower.php

Just a test

* Update class-follower.php

* Update class-follower.php

---------

Co-authored-by: Matthias Pfefferle <[email protected]>
  • Loading branch information
janboddez and pfefferle authored Jan 26, 2024
1 parent dad6b73 commit 2b8480f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion includes/model/class-follower.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ public function save() {
}
}

$post_id = $this->get__id();

$args = array(
'ID' => $this->get__id(),
'ID' => $post_id,
'guid' => esc_url_raw( $this->get_id() ),
'post_title' => wp_strip_all_tags( sanitize_text_field( $this->get_name() ) ),
'post_author' => 0,
Expand All @@ -174,6 +176,14 @@ public function save() {
'meta_input' => $this->get_post_meta_input(),
);

if ( ! empty( $post_id ) ) {
// If this is an update, prevent the "followed" date from being
// overwritten by the current date.
$post = get_post( $post_id );
$args['post_date'] = $post->post_date;
$args['post_date_gmt'] = $post->post_date_gmt;
}

$post_id = wp_insert_post( $args );
$this->_id = $post_id;

Expand Down

0 comments on commit 2b8480f

Please sign in to comment.