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; ?>
http://codex.wordpress.org/Function_Reference/is_term提到is_term
被替换term_exists
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.