Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DUPP-33 Fix scheduled republish bug #218

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/post-republisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ public function republish_scheduled_post( $copy ) {
return;
}

\kses_remove_filters();
$this->republish( $copy, $original_post );
\kses_init_filters();
$this->delete_copy( $copy->ID, $original_post->ID );
}

Expand Down Expand Up @@ -324,7 +326,7 @@ protected function republish_post_elements( $post, $original_post ) {
$_POST['ID'] = $original_post->ID;

// Republish the original post.
$rewritten_post_id = \wp_update_post( \wp_slash( $post_to_be_rewritten ) );
$rewritten_post_id = \wp_update_post( $post_to_be_rewritten );

if ( $rewritten_post_id === 0 ) {
\wp_die( \esc_html__( 'An error occurred while republishing the post.', 'duplicate-post' ) );
Expand Down
3 changes: 3 additions & 0 deletions tests/post-republisher-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public function test_republish_scheduled_post() {
->once()
->andReturn( $original );

Monkey\Functions\expect( 'kses_remove_filters' );
Monkey\Functions\expect( 'kses_init_filters' );

$this->instance->expects( 'republish' )->with( $copy, $original )->once();
$this->instance->expects( 'delete_copy' )->with( $copy->ID, $original->ID )->once();

Expand Down