mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-14 22:56:19 +01:00
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:
parent
11ba27a054
commit
85d594a716
@ -696,8 +696,10 @@ function wp_count_comments( $post_id = 0 ) {
|
|||||||
|
|
||||||
$total = 0;
|
$total = 0;
|
||||||
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
$approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
|
||||||
|
$known_types = array_keys( $approved );
|
||||||
foreach( (array) $count as $row_num => $row ) {
|
foreach( (array) $count as $row_num => $row ) {
|
||||||
$total += $row['num_comments'];
|
$total += $row['num_comments'];
|
||||||
|
if ( in_array( $row['comment_approved'], $known_types ) )
|
||||||
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
$stats[$approved[$row['comment_approved']]] = $row['num_comments'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user