diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index 93ff0f7aaa..49b26cd5b6 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -1287,12 +1287,22 @@ add_filter( 'block_type_metadata', '_wp_multiple_block_styles' ); function build_comment_query_vars_from_block( $block ) { $comment_args = array( - 'orderby' => 'comment_date_gmt', - 'order' => 'ASC', - 'status' => 'approve', - 'no_found_rows' => false, + 'orderby' => 'comment_date_gmt', + 'order' => 'ASC', + 'status' => 'approve', + 'no_found_rows' => false, ); + if ( is_user_logged_in() ) { + $comment_args['include_unapproved'] = array( get_current_user_id() ); + } else { + $unapproved_email = wp_get_unapproved_comment_author_email(); + + if ( $unapproved_email ) { + $comment_args['include_unapproved'] = array( $unapproved_email ); + } + } + if ( ! empty( $block->context['postId'] ) ) { $comment_args['post_id'] = (int) $block->context['postId']; } diff --git a/wp-includes/version.php b/wp-includes/version.php index c28447469a..0b6f5f57cd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta3-53297'; +$wp_version = '6.0-beta3-53298'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.