From bdc8924ea4c14d893bc6e8099db09ab1ac8bb5a0 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 4 May 2011 18:46:03 +0000 Subject: [PATCH] Fix notice thrown in wp_count_comments(). Props tfnab, batmoo. fixes #15215 git-svn-id: http://svn.automattic.com/wordpress/trunk@17795 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 3dea3be15..fe873fba6 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -904,12 +904,11 @@ function wp_count_comments( $post_id = 0 ) { $total = 0; $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed'); - $known_types = array_keys( $approved ); foreach ( (array) $count as $row ) { // Don't count post-trashed toward totals if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] ) $total += $row['num_comments']; - if ( in_array( $row['comment_approved'], $known_types ) ) + if ( isset( $approved[$row['comment_approved']] ) ) $stats[$approved[$row['comment_approved']]] = $row['num_comments']; }