[wp-trac] [WordPress Trac] #17019: context arg for WP_Query filter application
WordPress Trac
wp-trac at lists.automattic.com
Thu Apr 7 06:27:02 UTC 2011
#17019: context arg for WP_Query filter application
-------------------------+------------------------------
Reporter: kevinB | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Comment (by kevinB):
Replying to [comment:9 nacin]:
> Why not just add the filter, run WP_Query, remove the filter? There's no
need for extra context values for filters/actions. It's too much overhead.
I've attached a stripped-down patch as you suggest. I can live with that,
but want to follow up on the original patch discussion just for clarity.
I'm not sure what filter you're referring to here. The whole point of this
ticket is to make more wp-admin queries filterable, and scribu said to do
that by running through get_posts(). That's good, but it also means every
function which my plugin adds to a query-related hook will now be called
multiple times via call_user_func_array() even if it only pertains to a
specific case (like attachment orphan count filtering). To avoid
incurring the performance hit I'll end up hooking a single wrapper filter
to 'posts_where', then look at the context property to decide the actual
filter to apply. Is that the direction you want WP plugin best practices
to go?
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17019#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list