mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-10 12:50:18 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@53225 git-svn-id: http://core.svn.wordpress.org/trunk@52814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8aef26cfe3
commit
40942c2695
@ -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(
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta2-53224';
|
||||
$wp_version = '6.0-beta2-53225';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user