From 33938f5991c95299afa5eb7c68234386e73fb82e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 12 Mar 2019 22:49:14 +0000 Subject: [PATCH] Comments: Improve comment content filtering. Merges [44842] to the 4.0 branch. Built from https://develop.svn.wordpress.org/branches/4.0@44854 git-svn-id: http://core.svn.wordpress.org/branches/4.0@44686 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 2 ++ wp-comments-post.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 933849f7ba..e5472768dc 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -943,6 +943,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 { diff --git a/wp-comments-post.php b/wp-comments-post.php index 0ed359c5bb..0031579e60 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -108,6 +108,8 @@ if ( $user->exists() ) { ) { 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 {