From 85d594a71630f9d7ea8c19d36b9bf71cfcf51356 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Tue, 9 Dec 2008 08:07:52 +0000 Subject: [PATCH] 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 --- wp-includes/comment.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index b034013ee7..4d0c6d4b70 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -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;