diff --git a/wp-includes/comment.php b/wp-includes/comment.php index b14e49d117..d1dacf243e 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2277,9 +2277,14 @@ function wp_new_comment( $commentdata, $wp_error = false ) { $commentdata['comment_type'] = 'comment'; } + $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); + $commentdata = wp_filter_comment( $commentdata ); - $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); + if ( ! in_array( $commentdata['comment_approved'], array( 'trash', 'spam' ), true ) ) { + // Validate the comment again after filters are applied to comment data. + $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $wp_error ); + } if ( is_wp_error( $commentdata['comment_approved'] ) ) { return $commentdata['comment_approved']; diff --git a/wp-includes/version.php b/wp-includes/version.php index 5082967083..976313b307 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-beta3-59266'; +$wp_version = '6.7-beta3-59267'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.