diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 70af8a10d6..241701e133 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1111,6 +1111,13 @@ function wp_richedit_pre($text) { return apply_filters('richedit_pre', $output); } +function wp_htmledit_pre($output) { + if ( !empty($output) ) + $output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > & + + return apply_filters('htmledit_pre', $output); +} + function clean_url( $url, $protocols = null, $context = 'display' ) { $original_url = $url; diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index be3d67c3a0..e56931f8b0 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -932,6 +932,8 @@ function the_editor($content, $id = 'content', $prev_id = 'title') { if ( 'tinymce' == $wp_default_editor ) add_filter('the_editor_content', 'wp_richedit_pre'); + else if ( 'html' == $wp_default_editor ) + add_filter('the_editor_content', 'wp_htmledit_pre'); // The following line moves the border so that the active button "attaches" to the toolbar. Only IE needs it. ?>