Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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