Even better, array functions are fun.
git-svn-id: https://develop.svn.wordpress.org/trunk@2977 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
2b2c2e6c03
commit
cdb58724d2
@ -1293,11 +1293,11 @@ 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 ) )
|
||||
$comment_count_cache["$id"] = 0;
|
||||
$no_comments = array_diff( $post_id_array, $has_comments );
|
||||
foreach ( $no_comments as $id )
|
||||
$comment_count_cache["$id"] = 0;
|
||||
}
|
||||
|
||||
// Get post-meta info
|
||||
|
Loading…
Reference in New Issue
Block a user