diff --git a/modules/markdown/easy-markdown.php b/modules/markdown/easy-markdown.php index d218a664855ec..1eaa02cb5fd02 100644 --- a/modules/markdown/easy-markdown.php +++ b/modules/markdown/easy-markdown.php @@ -504,8 +504,9 @@ public function transform( $text, $args = array() ) { 'unslash' => true, 'decode_code_blocks' => ! $this->get_parser()->use_code_shortcode ) ); - // probably need to unslash - if ( $args['unslash'] ) + + // If unslash is not true, strip the slashes + if ( empty( $args['unslash'] ) || false == 'unslash' ) $text = wp_unslash( $text ); $text = apply_filters( 'wpcom_markdown_transform_pre', $text, $args ); @@ -530,7 +531,7 @@ public function transform( $text, $args = array() ) { $text = apply_filters( 'wpcom_markdown_transform_post', $text, $args ); // probably need to re-slash - if ( $args['unslash'] ) + if ( empty( $args['unslash'] ) || false == 'unslash' ) $text = wp_slash( $text ); return $text; @@ -659,8 +660,10 @@ protected function swap_for_editing( $post ) { $markdown = $this->get_parser()->codeblock_restore( $markdown ); // restore beginning of line blockquotes $markdown = preg_replace( '/^> /m', '> ', $markdown ); + $post->post_content_filtered = $post->post_content; - $post->post_content = $markdown; + $post->post_content = wp_slash( $markdown ); + return $post; }