[wp-trac] [WordPress Trac] #43599: WP is asking for comment count for post 0

WordPress Trac noreply at wordpress.org
Thu Jan 27 13:06:38 UTC 2022


#43599: WP is asking for comment count for post 0
-------------------------------+---------------------
 Reporter:  Grzegorz.Janoszka  |       Owner:  (none)
     Type:  enhancement        |      Status:  closed
 Priority:  normal             |   Milestone:  5.3
Component:  Comments           |     Version:  4.9.5
 Severity:  normal             |  Resolution:  fixed
 Keywords:                     |     Focuses:
-------------------------------+---------------------
Changes (by SergeyBiryukov):

 * keywords:  needs-docs =>
 * status:  reopened => closed
 * resolution:   => fixed
 * milestone:  Awaiting Review => 5.3


Comment:

 Replying to [comment:1 soulseekah]:
 > The docblock does not explicitly state this, but calling
 `wp_count_comments` and `get_comment_count` with 0 (or no argument)
 returns the totals for the whole blog, so caching seems to actually be
 valid here.

 It looks like this was addressed in [46223] / #47110, both functions
 mention it in the DocBlock now:
 {{{
 @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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43599#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list