Comments: Apply kses when editing comments.

Props davidbaumwald, xknown, peterwilsoncc, paulkevan.

Built from https://develop.svn.wordpress.org/trunk@54527


git-svn-id: http://core.svn.wordpress.org/trunk@54082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2022-10-17 11:31:12 +00:00
parent aea22e6fdf
commit 566d22260a
2 changed files with 14 additions and 1 deletions

View File

@ -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 );

View File

@ -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.