diff --git a/wp-includes/comment.php b/wp-includes/comment.php index bf4f430e41..b5be18ed7a 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2499,6 +2499,15 @@ function wp_update_comment( $commentarr, $wp_error = false ) { } } + $filter_comment = false; + if ( ! has_filter( 'pre_comment_content', 'wp_filter_kses' ) ) { + $filter_comment = ! user_can( isset( $comment['user_id'] ) ? $comment['user_id'] : 0, 'unfiltered_html' ); + } + + if ( $filter_comment ) { + add_filter( 'pre_comment_content', 'wp_filter_kses' ); + } + // Escape data pulled from DB. $comment = wp_slash( $comment ); @@ -2509,6 +2518,10 @@ function wp_update_comment( $commentarr, $wp_error = false ) { $commentarr = wp_filter_comment( $commentarr ); + if ( $filter_comment ) { + remove_filter( 'pre_comment_content', 'wp_filter_kses' ); + } + // Now extract the merged array. $data = wp_unslash( $commentarr ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 8be439b902..1ea3f15c2f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-RC1-54526'; +$wp_version = '6.1-RC1-54527'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.