1

I have a menu set up like this:

Page 1
Page 2
    Page 2.1
    CPT Archive
    Page 2.2
Page 3
etc...

And when I navigate to the Archive, the Page 2 menu item does not have the "current-menu-ancestor" or "current-menu-item" classes.

Is this a bug or am I misunderstanding how WordPress menu classes should work?

4
  • I believe that's correct. There's no relation liking the Archive page and Page 2. The nesting done in appearances -> menu, does not create a relation.
    – gdaniel
    Commented Jan 17, 2017 at 18:49
  • Ah, I expected the two classes to be added depending on the structure of the menu, not the page hierarchy. Too bad! Guess I'll just use a page and a shortcode instead. Thanks.
    – The Maniac
    Commented Jan 17, 2017 at 18:53
  • You can also try using body classes. So your menu highlight would change according to the body class on the document.
    – gdaniel
    Commented Jan 17, 2017 at 19:40
  • You can also use the nav_menu_css_class filter to modify classes for specific menu items.
    – Milo
    Commented Jan 18, 2017 at 4:22

1 Answer 1

2

It seems this is being fixed in the next version of Wordpress. As a ticket with a patch is now labeled 4.8, check https://core.trac.wordpress.org/ticket/39800.

1
  • 1
    Just for the records, it was not patched in 4.8. The ticket milestone has been changed for future release
    – TheBird956
    Commented Jun 15, 2017 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.