I've created a custom post type ("Products") for a site I'm developing, along with corresponding custom categories ("product_cats"). Certain products are categorized with "BC Buy Local" as well as their product family ("Rice Wrap" for example).

So far everything's working great, I can display what product famlies I want, and I can even call up ALL the products categorized as "BC Buy Local" with this URL:


But I want these items to have an indication of their "BC Buy Local" status, wherever they appear - and they are all members of other product families, i.e. categories. But when being displayed via their so-called "family" category, it seems that these items do not also get flagged as being in the "BC Buy Local" category. So, the list of products here:


...ignores my attempt to add an indication of their BC Buy Local category by adding this code after the product name, in the loop:

<?php if ( is_tax ('product_cats', 'bc-buy-local') ) { echo 'BC Buy Local'; } ?>

I've located much discussion of the limitations of "is_tax" here on StackOverflow, but - so far - no indication of how to address this issue. Apparently i need to use a combination of "is_tax" and "has_term" but I can't figure out how to do this.

It seems it should be so simple... can anyone advise?

Thanks! Adam

  • 2
    is_tax checks if you are on a particular archive, has_term checks if a post has a particular term. it seems you want just has_term.
    – Milo
    Commented Dec 27, 2016 at 22:15
  • Thanks Milo, I had high hopes for has_term but when I use it instead, I just get no results at all under any circumstances, or so it seems. I assume my code would otherwise be the same? I.E. passing the taxonomy name and the term? Commented Dec 27, 2016 at 22:50
  • has_term needs a post object to operate on, as it pertains to specific posts, so where you try to use it is very important!
    – Milo
    Commented Dec 27, 2016 at 22:54
  • I'll study up on it and hopefully get it working for me. Thanks! Commented Dec 28, 2016 at 2:59

1 Answer 1


Thanks Milo, it was "has_term" that I needed. I found some VERY complex "answers" elsewhere that seemed to be addressing my situation, but am glad it was just a matter of using the right function.

One thing that tripped me up for a while: has_term takes the specific term, THEN the taxonomy as arguments - in that order. Unlike is_tax which seems to be in the OPPOSITE order. Yikes!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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