Make WordPress Core

Ticket #56499: 56499.diff

File 56499.diff, 1.1 KB (added by SergeyBiryukov, 2 years ago)
  • src/wp-admin/includes/dashboard.php

     
    10581058                $comments_query['status'] = 'approve';
    10591059        }
    10601060
    1061         while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
    1062                 if ( ! is_array( $possible ) ) {
     1061        do {
     1062                $possible = get_comments( $comments_query );
     1063
     1064                if ( empty( $possible ) || ! is_array( $possible ) ) {
    10631065                        break;
    10641066                }
    10651067
     
    10681070                                continue;
    10691071                        }
    10701072
    1071                         $comments[] = $comment;
     1073                        $comments[]     = $comment;
     1074                        $comments_count = count( $comments );
    10721075
    1073                         if ( count( $comments ) === $total_items ) {
     1076                        if ( $comments_count === $total_items ) {
    10741077                                break 2;
    10751078                        }
    10761079                }
     
    10771080
    10781081                $comments_query['offset'] += $comments_query['number'];
    10791082                $comments_query['number']  = $total_items * 10;
    1080         }
     1083        } while ( $comments_count < $total_items );
    10811084
    10821085        if ( $comments ) {
    10831086                echo '<div id="latest-comments" class="activity-block table-view-list">';