[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:38:54 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:6 johnbillion]:
 > Also note that caching the comment count can actually decrease
 performance on sites which get a very high number of comments, because the
 cache value will constantly get flushed. This was mentioned in another
 ticket which I can't immediately find.

 Bummer. Good to know.

 I'm wondering if building in logic that we only call wp_count_comments()
 if that menu item is set would do it. It's dirty, but it could work.
 Everything else has some sort of way to stop the querying of the entire
 comments table.

 The total comment count in the 'Right Now' dashboard widget can be
 disabled and the query prevented by unsetting the 'right now' meta box
 using the 'wp_dashboard_setup' action.

 The pending comment count column can be disabled and the query prevented
 on the /wp-admin/edit.php screen by unsetting the 'comments' column in the
 'manage_posts_columns' filter

 As mentioned before, the 'edit_posts' solution on #19372, for people who
 dont need to see it, does not allow for the disabling of this query
 entirely, which is needed for larger sites.

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


More information about the wp-trac mailing list