WordPress.org

Ready to get started?Download WordPress

Forums

is_tax() no longer working after upgrade to 3.5 (6 posts)

  1. JonMasterson
    Member
    Posted 1 year ago #

    I have custom menus on my site which utilize is_tax($taxonomy, $term(s)) to identify whether users are on specific taxonomy archive pages. A "current" class is added to the menu item if the taxonomy/taxonomy term matches the menu item (allowing me to highlight it).

    All was working great before the upgrade to 3.5, but my menu highlights no longer function after. I reverted my test site to 3.4.2, and everything functioned again.

    Has is_tax() been depreciated? If so, what is the proper conditional statement to identify specific taxonomy archive pages? Thanks!

  2. Can you post your code?

  3. JonMasterson
    Member
    Posted 1 year ago #

    <?php if (is_tax('businesses', array('offices','the-offices','office-buildings'))) { _e( 'class="current-menu-item"'); } else { _e( ''); } ?>

    This example is representative of all items in this menu. If we're on the taxonomy archive pages for "offices", "office-buildings", or "offices" (which are all taxonomy terms in the "businesses" taxonomy), it should show me some love and insert the "current-menu-item" class onto this menu item.

    Love is shown in 3.4.2, but 3.5 has no love for me. Yet. Thanks!

  4. Dillx
    Member
    Posted 1 year ago #

    Is this a bug with 3.5 ? I seem to have a similar problem.
    If it is a bug where does it get reported and is anyone looking at it ?

  5. Dillx
    Member
    Posted 1 year ago #

    I have managed to get round it using this

    $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
    $my_tax=$the_tax->labels->name;

    Then I test the name.

  6. JonMasterson
    Member
    Posted 1 year ago #

    I actually found an error in my code. is_tax() works great! Sorry for any confusion!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags