[wp-trac] [WordPress Trac] #30928: Small performance improvement of wp_count_posts

WordPress Trac noreply at wordpress.org
Tue Jan 6 13:19:26 UTC 2015


#30928: Small performance improvement of wp_count_posts
-------------------------------+-----------------------------
 Reporter:  minderdl           |      Owner:
     Type:  enhancement        |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  trunk
 Severity:  normal             |   Keywords:
  Focuses:                     |
-------------------------------+-----------------------------
 In wp_count_posts() the query is built all the time, even if the results
 from the cache are used (for which only the cache key is needed). Is there
 a reason for this?

 IMO a small performance improvement can be made by moving the lines
 building $query inside the "if ( false === $counts )" branch.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30928>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list