diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 0ed7747a64..fd2f007686 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -251,6 +251,11 @@ final class _WP_Editors { '%s' ); + // Prepare the content for the Visual or Text editor + if ( self::$this_tinymce ) { + add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); + } + /** * Filter the default editor content. * @@ -270,6 +275,10 @@ final class _WP_Editors { $content = apply_filters( 'richedit_pre', $content ); } + if ( false !== stripos( $content, 'textarea' ) ) { + $content = preg_replace( '%\n\n"; diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index b1f69ea98c..07f449f2f3 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -203,9 +203,6 @@ add_filter( 'title_save_pre', 'trim' ); add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 ); -// Prepare the content for the Visual or Text editor -add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); - // Actions add_action( 'wp_head', '_wp_render_title_tag', 1 ); add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index ba573908ef..afb361109e 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -3087,10 +3087,7 @@ function ent2ncr( $text ) { * @return string The formatted text after filter is applied. */ function format_for_editor( $text, $default_editor = null ) { - // Back-compat: check if any characters need encoding. - if ( ! empty( $text ) && ( false !== strpos( $text, '<' ) || false !== strpos( $text, '>' ) || - preg_match( '/&(?!#(?:\d+|x[a-f0-9]+);|[a-z1-4]{1,8};)/i', $text ) ) ) { - + if ( $text ) { $text = htmlspecialchars( $text, ENT_NOQUOTES, get_option( 'blog_charset' ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 2eaf793d71..42a1239e75 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-beta2-33186'; +$wp_version = '4.3-beta2-33187'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.