Support » Fixing WordPress » current-menu-ancestor class not showing up in nav menu of mixed type items

  • I’m using wp_nav_menu to show a multi-depth menu consisting of different types of items, p.e:

    • Page
    • Custom Taxonomy term archive

    When I’m on ‘Page’ the first level item has the class current-menu-item as intended.
    When on the term archive ‘Page’ has the class current-menu-parent' and the archive menu itemcurrent-menu-item`.
    All good so far.

    When I now visit a post that has the archive’s term assigned the sublevel term menu item has current-menu-parent but the ‘Page’ has no current-*class at all.

    Is this an intended behavior?
    Since it seems a bit illogical to me, is there any fix how to mark the all items of the menu branch with classes if any of its sub items has a current-* class?

    thx

Viewing 1 replies (of 1 total)
  • Twig

    (@palpatine1976)

    +1

    Up until now, I’ve had to use javascript to add current-menu-ancestor classes back up to the root for any item that is a ‘current’ menu. Would be great if this was built into core.. or even an easy patch for a custom Nav Walker function

Viewing 1 replies (of 1 total)
  • The topic ‘current-menu-ancestor class not showing up in nav menu of mixed type items’ is closed to new replies.