Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to target a specific category from a custom taxonomy. This is for WooCommerce.

So, the custom taxonomy is called "product_cat" and the category itself is called "adult-dvds".

This is what I tried; however, it didn't work (nothing shows up between the comment tags):

    <!-- Custom Fields -->
    <?php if (is_tax('product_cat','adult-dvds')) { ?> 
        <p>blah blah blah</p>
    <?php } ?>
    <!-- End Custom Fields -->

Is there something I missed?

share|improve this question

2 Answers 2

I ended up using this bit of code and it worked:

<?php if (has_term('adult-dvds','product_cat')) { ?> 
    <p>blah blah blah</p>
<?php } ?>
share|improve this answer
as of 2015. This worked for me! @desi – BeEasy Aug 5 at 19:43

Are your custom taxonomy's slug is product-cat? The is_tax() function need parameter of the taxonomy slug, not the id. So this should work:

if (is_tax('product-cat','adult-dvds')) {
    // do something
share|improve this answer
Unfortunately, this didn't work. – Desi Sep 1 '12 at 16:51
What I mean by that is that, still, nothing is showing up between the comment tags. – Desi Sep 1 '12 at 17:46
are you opening with kind like /product-cat/adult-dvds? if yes, this conditional sholud work. – rizqyhi Sep 2 '12 at 3:26
Hm, it's still not working. Do you think I should be using something other than is_tax? – Desi Sep 2 '12 at 7:41

Your Answer


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.