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

WordPress Trac wp-trac at lists.automattic.com
Sun Nov 27 16:37:27 UTC 2011


#19372: Don't call wp_count_comments() when we don't need to
-------------------------+-----------------------------
 Reporter:  johnbillion  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Performance  |    Version:  3.2
 Severity:  minor        |   Keywords:
-------------------------+-----------------------------
 Comments get counted on every admin screen with `wp_count_comments()`. We
 can skip a database call by not counting them if the user doesn't have the
 `edit_posts` capability.
 ----
 ''Side note:'' With a persistent object cache it's possible to have admin
 screens with zero database queries with this patch applied. As an exercise
 you could write a database class that lazy loads MySQL and you'll get an
 admin screen that doesn't load MySQL. Almost completely pointless, but
 interesting nonetheless.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19372>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list