Conditional to see if we're on a single term for a custom taxonomy
-
Hello, I’ve been searching the docs and Google for a way to test if the current page is any term of a specific custom taxonomy. So we’re currently viewing “Picasso” of the custom taxonomy “Artist”. We’re not on a post page or an archive page; we’re using the template: taxonomy-artist.php and viewing a single term. How do I test for that?
term_exists(‘artist’), has_term(‘artist’), is_tax(‘artist’) and is_category(‘artist’) don’t seem to do the trick. I’m 100% certain that the taxonomy is “artist”.
Must be missing something obvious? Thanks in advance for any help!
<?php if ( is_page() ) { do something } elseif ( is_tax('artist') ) {
- The topic ‘Conditional to see if we're on a single term for a custom taxonomy’ is closed to new replies.