[wp-hackers] something like a post_get_posts?
Josh
joshua.sibelman at gmail.com
Tue Sep 10 17:36:46 UTC 2013
Great, thanks.
On Tuesday, September 10, 2013 at 10:04 AM, Jeremy Clarke wrote:
> On Fri, Sep 6, 2013 at 5:04 PM, Josh <joshua.sibelman at gmail.com (mailto: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 (http://jeremyclarke.org)
> Code and Design • globalvoicesonline.org (http://globalvoicesonline.org)
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com (mailto:wp-hackers at lists.automattic.com)
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
More information about the wp-hackers
mailing list