WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This code returns my WordPress menu:

 <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'header-menu') ); ?>

What's the easiest (non-JS) way of adding additional class to all .sub-menu ul dropdowns of this menu?

I was thinking about add_filter() for wp_nav_menu but I'm afraid it will point all wp_nav_menus and I want to add these classes only to this particular one. Also, custom walker sounds a bit like an overkill.

What would you recommend?

share|improve this question
What is the purpose of this? Because WP already adds proper CSS classes for if a menu has child and or sub menu that has parent. If this is not what you're looking for and you need something more customized, then I am afraid custom walker is your best bet. – user23654 Aug 31 '13 at 14:53
This may help you stackoverflow.com/questions/5034826/… – Dejo Dekic Aug 31 '13 at 21:45
@splashingpixels - OOCSS. – Wordpressor Oct 23 '13 at 11:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.