Comments: Improve comment content filtering.

Merges [44842] to the 4.7 branch.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@44847 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-03-12 22:35:52 +00:00
parent ba357da827
commit 1961df533b
2 changed files with 4 additions and 0 deletions

View File

@ -1020,6 +1020,8 @@ function wp_ajax_replyto_comment( $action ) {
if ( wp_create_nonce( 'unfiltered-html-comment' ) != $_POST['_wp_unfiltered_html_comment'] ) {
kses_remove_filters(); // start with a clean slate
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 {

View File

@ -3050,6 +3050,8 @@ function wp_handle_comment_submission( $comment_data ) {
) {
kses_remove_filters(); // start with a clean slate
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 {