[wp-trac] [WordPress Trac] #19903: wp_count_comments() and get_comments_count() both do SQL queries
WordPress Trac
wp-trac at lists.automattic.com
Thu Jan 26 22:16:42 UTC 2012
#19903: wp_count_comments() and get_comments_count() both do SQL queries
-------------------------+-------------------
Reporter: markjaquith | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.4
Component: Comments | Version: 3.3.1
Severity: normal | Keywords:
-------------------------+-------------------
{{{wp_count_comments()}}} and {{{get_comments_count()}}} are similar
functions, with a few differences:
* Their results are returned in different formats:
* {{{wp_count_comments()}}} returns an array of:
* spam
* approved
* moderated
* total_comments
* trash
* post-trashed
* {{{get_comment_count()}}} returns an array of:
* spam
* approved
* awaiting_moderation
* total_comments
* {{{wp_count_comments()}}} caches, but {{{get_comment_count()}}} always
hits the database.
* {{{get_comment_count()}}} is used nowhere in WordPress core.
I propose that we add 'trash' and 'post-trashed' reporting to
{{{get_comment_count()}}}, and then have {{{wp_count_comments()}}} use
{{{get_comment_count()}}} instead of doing its own SQL queries.
See #6884 and #19901
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19903>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list