diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index b198325f27..2d79d81622 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -1074,8 +1074,10 @@ function wp_dashboard_recent_comments( $total_items = 5 ) { $comments_query['status'] = 'approve'; } - while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { - if ( ! is_array( $possible ) ) { + do { + $possible = get_comments( $comments_query ); + + if ( empty( $possible ) || ! is_array( $possible ) ) { break; } @@ -1088,16 +1090,17 @@ function wp_dashboard_recent_comments( $total_items = 5 ) { continue; } - $comments[] = $comment; + $comments[] = $comment; + $comments_count = count( $comments ); - if ( count( $comments ) === $total_items ) { + if ( $comments_count === $total_items ) { break 2; } } $comments_query['offset'] += $comments_query['number']; $comments_query['number'] = $total_items * 10; - } + } while ( $comments_count < $total_items ); if ( $comments ) { echo '
'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 1cf321af67..b6f0b91657 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60642'; +$wp_version = '6.9-alpha-60643'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.