[wp-hackers] exclude category from main loops via plugin
Jeremy Clarke
jer at simianuprising.com
Fri Dec 17 16:21:20 UTC 2010
On Fri, Dec 17, 2010 at 10:33 AM, Paul <paul at codehooligans.com> wrote:
>
> In your code you are calling the function is_feed(). Isn't this wrong?
>
> When you call the is_* functions (exluding is_admin()) like is_home(),
> is_search(), is_archive() etc. they check the setting of the global
> $wp_query object. But this is not always the correct instance of the
> WP_Query object being queried. In other words some other part of the code
> may create a new instance.
>
>
In the case of my code above it only runs once on the first query after
parse_request, which is almost definitely the main query.
In any event what I want to know is "Are we in an RSS feed context?" and
is_feed() answers that question for the page as a whole. If we ARE in an RSS
feed then there will only ever be one query, the one that returns the feed
items. This means the question is really whether you want the
category__not_in (or whatever other query var) to affect feed results,
there's no other queries in feed pages that you need to worry about.
--
Jeremy Clarke
Code and Design • globalvoicesonline.org
More information about the wp-hackers
mailing list