From f046e9d27d4151c5bce7e608e166c1fe6d11aa84 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: http://svn.automattic.com/wordpress/trunk@1992 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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); }