[wp-trac] [WordPress Trac] #16603: Add hooks to wp_count_posts()
WordPress Trac
wp-trac at lists.automattic.com
Sat Apr 2 16:34:26 UTC 2011
#16603: Add hooks to wp_count_posts()
------------------------------------+------------------------------
Reporter: mikeschinkel | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch dev-feedback |
------------------------------------+------------------------------
Changes (by kevinB):
* cc: kevin@… (added)
Comment:
+1 for API consistency.
The appeal here is bring the wp_count_posts() API into line with filtering
that is already supported for the corresponding paged result set that
those counts are supposed to summarize. Without this, plugins/themes that
use the WP_Query hooks to filter editing access (on any basis) must choose
between an amateurish user experience (counts unfiltered / jQuery-
filtered) or "hacky" code (counts filtered via the 'query' hook).
I'm submitting an alternate patch against 3.2-bleeding which also applies
the filter on the cached return value. Without that, filtering is
bypassed if persistent caching is implemented via object-cache.php. With
it, persistent caching eliminates the redundant query.
I'm all for filtering the count query itself but left it out of this patch
in case the results filter is an easier sell, and due to implications with
persistent caching. By the way, I don't see where the 'counts' cache is
ever cleared on post save.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16603#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list