I'm wondering if it's possible to add a menu class to a navigation menu added to a widget area? I realize that when adding a menu to a template via wp_nav_menu one can use the menu_class option to append a custom class to the menu's <ul> element, but I can find a way to do the same to a menu added to a widget area- perhaps via filter? In my case, I need to add a class to trigger a menu script, and adding it via JS is creating issues, so I'd like to add it on the PHP side if possible. Thanks for any insight here!

  • Did you try just targeting a more specific class identifier? .footer .nav_menu ul ? (or whatever structure your theme is providing)
    – rudtek
    Nov 30, 2021 at 17:37
  • Yes, it's an annoying combination of factors- theme, script that runs the responsive menu, etc.- and it would be much easier if I could just add a class to the menu markup itself when the menu is generated.
    – nickpish
    Nov 30, 2021 at 19:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.