diff --git a/src/post-republisher.php b/src/post-republisher.php index 40e2a188a..eca6ee3c3 100644 --- a/src/post-republisher.php +++ b/src/post-republisher.php @@ -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 ); } @@ -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' ) ); diff --git a/tests/post-republisher-test.php b/tests/post-republisher-test.php index 649a5950c..6d6542668 100644 --- a/tests/post-republisher-test.php +++ b/tests/post-republisher-test.php @@ -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();