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
This commit is contained in:
Peter Wilson 2022-04-20 05:51:21 +00:00
parent 419e8248d6
commit dec48ad77a

View File

@ -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(