mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 10:02:43 +01:00
Fix notice thrown in wp_count_comments(). Props tfnab, batmoo. fixes #15215
git-svn-id: https://develop.svn.wordpress.org/trunk@17795 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f0a83251ec
commit
a65e06516f
@ -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'];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user