From ba2ba0e25245b242448672a05912e6347d8748dc Mon Sep 17 00:00:00 2001 From: matt Date: Sat, 29 Oct 2005 23:28:05 +0000 Subject: [PATCH] Even better, array functions are fun. git-svn-id: http://svn.automattic.com/wordpress/trunk@2977 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index e1cbbfbcdf..50458422d4 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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