I'm trying to add a class to the built-in WordPress Custom Menu Widget. All I need to do is add a class to the ul, which has a default class of startup-list.

I've added the classes with jQuery but if the user isn't using JS then their navigation would break.

There has to be a WordPress way. I've tried to:

apply_filters('wp_nav_menu', 'my-menu-name', array('menu_class' => 'my-new-class') );

This article got me close: How to Modify a Widgets UL and/or LI Classes

  • Have you registered the menu? Where is this code placed? – Aniket Sahrawat Oct 28 '16 at 16:46
  • I'm adding the filter in functions.php. No, I have not registered the menu. I only created the menu on the Dashboard. – Josh Smith Oct 28 '16 at 16:48

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.