mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
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:
parent
21c073a733
commit
f046e9d27d
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user