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

git-svn-id: http://svn.automattic.com/wordpress/trunk@10136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2008-12-09 08:07:52 +00:00
parent 11ba27a054
commit 85d594a716
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;