I'm working in Wordpress 4.9.5 For any WP navigation menu I create, what would be the best approach for adding a custom class name directly on the <ul> element? I need it on this element and prefer not to do javascript injections to add the class name to it.

1 Answer 1


I think this will solve your problem.

wp_nav_menu( array(
    'theme_location' => 'top-menu',
    'container' => false,
    'items_wrap' => '<ul class="nav your_custom_class">%3$s</ul>',

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.