Only count specific comment approval types for the types we know about, to avoid a potential notice. fixes #8503

git-svn-id: https://develop.svn.wordpress.org/trunk@10136 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2008-12-09 08:07:52 +00:00
parent 274079e8d4
commit 789a86a92a
1 changed files with 3 additions and 1 deletions

View File

@ -696,9 +696,11 @@ function wp_count_comments( $post_id = 0 ) {
$total = 0;
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
$known_types = array_keys( $approved );
foreach( (array) $count as $row_num => $row ) {
$total += $row['num_comments'];
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
if ( in_array( $row['comment_approved'], $known_types ) )
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
}
$stats['total_comments'] = $total;