WordPress.org

Make WordPress Core

Ticket #16879: 3.1-wp_count_comments.patch

File 3.1-wp_count_comments.patch, 772 bytes (added by tfnab, 4 years ago)
  • comment.php

     
    892892 
    893893        $total = 0; 
    894894        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); 
    895         $known_types = array_keys( $approved ); 
    896895        foreach ( (array) $count as $row ) { 
    897896                // Don't count post-trashed toward totals 
    898897                if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) 
    899898                        $total += $row['num_comments']; 
    900                 if ( in_array( $row['comment_approved'], $known_types ) ) 
     899                if ( isset($approved[$row['comment_approved']]) ) 
    901900                        $stats[$approved[$row['comment_approved']]] = $row['num_comments']; 
    902901        } 
    903902