[wp-hackers] something like a post_get_posts?
Jeremy Clarke
jer at simianuprising.com
Tue Sep 10 17:04:25 UTC 2013
On Fri, Sep 6, 2013 at 5:04 PM, Josh <joshua.sibelman at gmail.com> wrote:
> There's no post_get_posts, but is there another action I can hook into
> that might be workable?
>
>
I think the 'wp' action should offer what you need. IIRC it runs after the
main query is complete but before the template is rendered.
> loop_start seems like a good candidate but there's not much documentation
> about that one.
>
>
In theory this would work but be very careful. 'loop_start' will fire on
every single loop, including secondary queries for widgets, related posts
etc.
In either case you should be sure to check is_main_query() against your
WP_Query object before modifying it, or at least be aware of the difference
between filtering the main query of a screen versus filtering all possible
WP_Query instances.
http://codex.wordpress.org/Function_Reference/is_main_query
--
Jeremy Clarke • jeremyclarke.org
Code and Design • globalvoicesonline.org
More information about the wp-hackers
mailing list