[wp-trac] [WordPress Trac] #30250: Add filter for query used in `wp_count_posts()`

WordPress Trac noreply at wordpress.org
Sun Feb 8 14:27:18 UTC 2015


#30250: Add filter for query used in `wp_count_posts()`
----------------------------------------+-----------------------------
 Reporter:  danielbachhuber             |       Owner:  iworks
     Type:  enhancement                 |      Status:  assigned
 Priority:  normal                      |   Milestone:  Future Release
Component:  Posts, Post Types           |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  good-first-bug needs-patch  |     Focuses:
----------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * keywords:  good-first-bug has-patch needs-testing needs-refresh => good-
     first-bug needs-patch


Comment:

 Replying to [comment:2 minderdl]:
 > I'm not sure about this approach. The line with the counts is above the
 filters. Therefore, it's not on the same level.

 I think this ticket is about a custom list table built by a custom query,
 not about the All dates/All categories filters.

 [attachment:30250.diff] does not seem like a correct solution here.

 We should introduce something like
 [http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_clauses
 'posts_clauses' filter], but specific to the query in `wp_count_posts()`.

 We could also add a third parameter, `$args`, and use WP_Query to get post
 IDs and use them in the `WHERE` clause, but that seems out of the scope of
 this ticket.

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


More information about the wp-trac mailing list