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
This commit is contained in:
michelvaldrighi 2004-12-22 14:36:26 +00:00
parent ea09591ef3
commit 7092499610
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}