Comments: Improve comment content filtering.

Merges [44842] to the 4.4 branch.
Built from https://develop.svn.wordpress.org/branches/4.4@44850


git-svn-id: http://core.svn.wordpress.org/branches/4.4@44682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-03-12 22:40:20 +00:00
parent ab80be3ffa
commit f797452514
2 changed files with 4 additions and 0 deletions

View File

@ -1007,6 +1007,8 @@ function wp_ajax_replyto_comment( $action ) {
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) { if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate kses_remove_filters(); // start with a clean slate
kses_init_filters(); // set up the filters kses_init_filters(); // set up the filters
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
add_filter( 'pre_comment_content', 'wp_filter_kses' );
} }
} }
} else { } else {

View File

@ -2757,6 +2757,8 @@ function wp_handle_comment_submission( $comment_data ) {
) { ) {
kses_remove_filters(); // start with a clean slate kses_remove_filters(); // start with a clean slate
kses_init_filters(); // set up the filters kses_init_filters(); // set up the filters
remove_filter( 'pre_comment_content', 'wp_filter_post_kses' );
add_filter( 'pre_comment_content', 'wp_filter_kses' );
} }
} }
} else { } else {