简体   繁体   中英

is_category function for custom taxonomy's terms

I'm trying to find a conditional tag for recognizing the opened term of custom taxonomy. Let's say I have a taxonomy "map" and I'm browsing the taxonomy's term called 'USA' with ID 50. Is there something like deprecated is_term ?

Like:

<?php if(is_term(50, 'map')) : ?>
...
<?php endif; ?>

You have to use is_tax() , for this.

Here is the code:

//@param $taxonomy
//@param $term
if (is_tax('map', '50'))
{
    //DO your stuff.
}

Code is tested and works.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM