Even better, array functions are fun.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2718217d3b
commit
ba2ba0e252
|
@ -1293,10 +1293,10 @@ function update_post_caches(&$posts) {
|
|||
if ( $comment_counts ) {
|
||||
foreach ($comment_counts as $comment_count) {
|
||||
$comment_count_cache["$comment_count->comment_post_ID"] = $comment_count->ccount;
|
||||
$got_count[] = $comment_count->comment_post_ID;
|
||||
$has_comments[] = $comment_count->comment_post_ID;
|
||||
}
|
||||
foreach ( $post_id_array as $id )
|
||||
if ( !in_array( $id, $got_count ) )
|
||||
$no_comments = array_diff( $post_id_array, $has_comments );
|
||||
foreach ( $no_comments as $id )
|
||||
$comment_count_cache["$id"] = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue