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
This commit is contained in:
parent
1835dbf737
commit
bdc8924ea4
|
@ -904,12 +904,11 @@ function wp_count_comments( $post_id = 0 ) {
|
||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
|
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam', 'trash' => 'trash', 'post-trashed' => 'post-trashed');
|
||||||
$known_types = array_keys( $approved );
|
|
||||||
foreach ( (array) $count as $row ) {
|
foreach ( (array) $count as $row ) {
|
||||||
// Don't count post-trashed toward totals
|
// Don't count post-trashed toward totals
|
||||||
if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
|
if ( 'post-trashed' != $row['comment_approved'] && 'trash' != $row['comment_approved'] )
|
||||||
$total += $row['num_comments'];
|
$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'];
|
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue