[wp-trac] [WordPress Trac] #19372: Don't call wp_count_comments() when we don't need to

WordPress Trac noreply at wordpress.org
Thu Nov 5 01:54:13 UTC 2015


#19372: Don't call wp_count_comments() when we don't need to
----------------------------+-----------------------------
 Reporter:  johnbillion     |       Owner:  wonderboymusic
     Type:  task (blessed)  |      Status:  assigned
 Priority:  normal          |   Milestone:  4.4
Component:  Comments        |     Version:  3.2
 Severity:  minor           |  Resolution:
 Keywords:  has-patch       |     Focuses:  performance
----------------------------+-----------------------------

Comment (by boonebgorges):

 @justindocanto I'm not opposed to a more explicit flag. I think what this
 flag would do is disable the display of the comment count within the
 Comments menu item, *not* disable the menu item altogether. No other top-
 level menu items can be disabled via filter at the moment, so I don't see
 a reason to introduce this functionality here. (Coming up with a more sane
 method for registering and rendering menus would be nice, but is way
 beyond the scope of this ticket.) I'd be glad to see a patch that does
 this.

 As for whether the `wp_count_comments` filter is a "hack" for this
 purpose: Yes, of course it is. I don't think anyone is defending it as a
 robust API. My only point in bringing it up in the context of this ticket
 was that someone said we needed a filter at the level of the
 `wp_count_comments` filter, and I wanted to point out that one already
 exists there. This can be used as a workaround until a more robust
 solution is in place.

 [attachment:19372.1.patch] should go in either way.

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


More information about the wp-trac mailing list