From 83f93e5e70359adc56bcbbdfecd00c741b042450 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 22 Dec 2015 22:39:01 +0000 Subject: [PATCH] Editor: remove the format_for_editor filter from `the_editor_content` after it runs as the next editor instance on the same page may not need it. Props marcochiesi, azaozz. Fixes #28403. git-svn-id: https://develop.svn.wordpress.org/trunk@36062 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-editor.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index ee877a3aaf..4296722092 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -251,7 +251,7 @@ final class _WP_Editors { '%s' ); - // Prepare the content for the Visual or Text editor + // Prepare the content for the Visual or Text editor, only when TinyMCE is used (back-compat). if ( self::$this_tinymce ) { add_filter( 'the_editor_content', 'format_for_editor', 10, 2 ); } @@ -267,6 +267,11 @@ final class _WP_Editors { */ $content = apply_filters( 'the_editor_content', $content, $default_editor ); + // Remove the filter as the next editor on the same page may not need it. + if ( self::$this_tinymce ) { + remove_filter( 'the_editor_content', 'format_for_editor' ); + } + // Back-compat for the `htmledit_pre` and `richedit_pre` filters if ( 'html' === $default_editor && has_filter( 'htmledit_pre' ) ) { // TODO: needs _deprecated_filter(), use _deprecated_function() as substitute for now