From ed88ef20727ce994be28420ff3f2ab4637cb1755 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 12 Mar 2019 22:33:45 +0000 Subject: [PATCH] Comments: Improve comment content filtering. Merges [44842] to the 5.0 branch. Built from https://develop.svn.wordpress.org/branches/5.0@44844 git-svn-id: http://core.svn.wordpress.org/branches/5.0@44676 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 2 ++ wp-includes/comment.php | 2 ++ wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 2e14996078..dd95155e76 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1070,6 +1070,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-includes/comment.php b/wp-includes/comment.php index 97685711bf..374467f8bf 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -3098,6 +3098,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 { diff --git a/wp-includes/version.php b/wp-includes/version.php index 3c43cb0ce5..155e8e0a4d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '5.0.4-alpha-44835'; +$wp_version = '5.0.4-alpha-44844'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.