[wp-hackers] Including custom post types on archive pages

Frank Bueltge frank at bueltge.de
Thu Jun 9 19:00:18 UTC 2011


@Nacin: yes, you have right; i will change on gist this.
Thanks


On Thu, Jun 9, 2011 at 7:23 PM, Andrew Nacin <wp at andrewnacin.com> wrote:

> On Thu, Jun 9, 2011 at 7:54 AM, Frank Bueltge <frank at bueltge.de> wrote:
>
> > See this gist for a example: https://gist.github.com/998648
> > Best regards
> > Frank
>
>
> Not really.
>
> pre_get_posts isn't a filter, it's an action where the query is passed by
> reference. So there's no return value, and it's add_action rather than
> add_filter.
>
> Don't check for suppress_filters. You're doing that to make sure this isn't
> a get_posts() call, rather than properly checking if this is the main
> query.
> The is_admin() and is_preview() checks are superfluous, given the is_home()
> and is_front_page() checks.
>
> So, a few options: Use the parse_request or request filters, which only
> fire
> on the main query. Or use $wp_the_query to confirm you're acting on the
> same
> query.
>
> Nacin
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list