From dec48ad77a39a5b6acbcf40b06bd3615704a8a4c Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 20 Apr 2022 05:51:21 +0000 Subject: [PATCH] Comments: Improve accuracy of `get_comment_count()` docblock. Remove reference to uncached database query now `get_comment_count()` uses `WP_Comment_Query` which contains caching. Remove reference to `$wpdb` global, it is no longer used. Follow up to [53036]. Fixes #19901. git-svn-id: https://develop.svn.wordpress.org/trunk@53225 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index 50e0082283..bf75246383 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -358,12 +358,8 @@ function get_lastcommentmodified( $timezone = 'server' ) { /** * Retrieves the total comment counts for the whole site or a single post. * - * Unlike wp_count_comments(), this function always returns the live comment counts without caching. - * * @since 2.0.0 * - * @global wpdb $wpdb WordPress database abstraction object. - * * @param int $post_id Optional. Restrict the comment counts to the given post. Default 0, which indicates that * comment counts for the whole site will be retrieved. * @return int[] { @@ -379,8 +375,6 @@ function get_lastcommentmodified( $timezone = 'server' ) { * } */ function get_comment_count( $post_id = 0 ) { - global $wpdb; - $post_id = (int) $post_id; $comment_count = array(