[wp-trac] [WordPress Trac] #32366: wp_count_comments() is hardcoded into /wp-admin/menu.php and queries all comments every single page load within the admin area, regardless of if edt_posts is removed from top menu or not
WordPress Trac
noreply at wordpress.org
Wed May 13 00:19:12 UTC 2015
#32366: wp_count_comments() is hardcoded into /wp-admin/menu.php and queries all
comments every single page load within the admin area, regardless of if
edt_posts is removed from top menu or not
-------------------------------------+-------------------------------------
Reporter: justindocanto | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Comments | Version: 4.2
Severity: normal | Resolution: duplicate
Keywords: needs-patch dev- | Focuses: administration,
feedback | performance
-------------------------------------+-------------------------------------
Comment (by justindocanto):
Replying to [comment:2 chriscct7]:
> - We could store the counts in options, and when a comment is added or
removed increment or decrement the options and then pull the numbers from
the options instead of querying the comments table
This reminds me of how wp_term_taxonomy has counts of the total amount of
posts for each term. Calling 1 option from the wp_options table to get the
total comment count would be much less resource usage than counting all
the comments every single time. We'd have to build in logic in the
add/delete comment functions (for functions used in the front-end and
back-end) to get an accurate count, but it would do the job.
We could also use this count on the 'Right Now' widget on the dashboard,
since it shows a total amount of comments there. I've had it disabled for
so long, i forgot about it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32366#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list