From 709249961097bac086957cb2061be82de6c01ed9 Mon Sep 17 00:00:00 2001 From: michelvaldrighi Date: Wed, 22 Dec 2004 14:36:26 +0000 Subject: [PATCH] typo id -> comment_id made WP make one extra query per post git-svn-id: https://develop.svn.wordpress.org/trunk@1992 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment-functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index d42116c9bb..46f9e66402 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -36,10 +36,10 @@ function clean_url( $url ) { function get_comments_number( $comment_id ) { global $wpdb, $comment_count_cache; $comment_id = (int) $comment_id; - if ('' == $comment_count_cache["$id"]) + if (!isset($comment_count_cache[$comment_id])) $number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'"); else - $number = $comment_count_cache["$id"]; + $number = $comment_count_cache[$comment_id]; return apply_filters('get_comments_number', $number); }