0

I think it's great to use conditional tags but if the query is slightly advanced it won't give information about the original query. For example; is_category('apple') might give a false response if "banana" AND "apple" has been queried. This is because is_category() compares against one single category and doesn't bother about the rest.

I need a way to know when I can expect that conditional tags won't give complete information about the original query. Can someone explain the limits of wordpress conditional tags?

  • There's an answer to this question and the correct answer would be useful for the wp community. – offroff Jul 22 '12 at 14:38
2

is_category('apple') might give a false response if "banana" AND "apple" has been queried

you're using is_category incorrectly in this context. From Codex:

is_category(); // When any Category archive page is being displayed.

A category archive page is for a single term, if a query is a for more than one term, it's not a term archive page. so it's not a matter of "giving complete information" it's a matter of understanding what each tag actually indicates.

  • Yeah, I can't use is_category() in some situations and that's why I ask for a better understanding. Like many others I use conditional tags in actions and filters, not just in specific templates. I don't believe that's wrong. – offroff Jul 21 '12 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.