Support » Fixing WordPress » I need a conditional for category of custom taxonomy

  • I seem to have run in an ungoogleable problem:

    I have a site with several custom taxonomies and I need a conditional that can tell me if i’m on an archive page that is a sub page of a specific custom taxonomy page

    for example: displays the custom taxonomy term transcriptions of the custom taxonomy spheres and then subsequently all the posts with category books. So all posts with transcriptions and books.

    is_tax(term,tax) returns false for this page, as it is technically a category_page.
    is_archive and is_category return true.

    so what I seemingly need is an is_tax_sub_archive() or something like that.

    I have a function that can tell me if one (or more) of the posts on the page has a specific custom taxonomy term, but that will return true even if I am on a general category page like, that happens to show one post with the term transcriptions.

    I can just pull transcriptions from the uri I guess and make that a conditional, but that seems such a hack. Upon typing this I’d figure it is a solution to my problem, so I did it:

    function is_tax_sub_archive($term){
    $the_uri = $_SERVER[‘REQUEST_URI’];
    if (strpos($the_uri,$term)) {
    return true;
    return false;

    However, there might be nicer solutions out there, as this will also return true for posts with the term in their title (which in my case is not a bad thing, but with a more common term name this would not work anymore).

    Thanks for helping me think through above issue,


  • The topic ‘I need a conditional for category of custom taxonomy’ is closed to new replies.