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
This commit is contained in:
michelvaldrighi 2004-12-22 14:36:26 +00:00
parent 21c073a733
commit f046e9d27d
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 ) { function get_comments_number( $comment_id ) {
global $wpdb, $comment_count_cache; global $wpdb, $comment_count_cache;
$comment_id = (int) $comment_id; $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'"); $number = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_id' AND comment_approved = '1'");
else else
$number = $comment_count_cache["$id"]; $number = $comment_count_cache[$comment_id];
return apply_filters('get_comments_number', $number); return apply_filters('get_comments_number', $number);
} }