I am trying to generate a menu using wp_nav_menu.I am stuck this . My expected output is this: Go!

                <a href="index.html" class="list-group-item">
                <a href="about.html" class="list-group-item">About us</a>
                <a href="service.html" class="list-group-item">Services</a>
                <a href="allumi.html" class="list-group-item">Allumi</a>

And i am using this code to aquire this:

   'Primary Menu', 'menu_class' => 'list-group-item','items_wrap'=>'%3$s' ]); ?>
i am not getting the expected result.can anyone help me?

  • it will add menu class to ul item. not to a tag.
    – Anwer AR
    Commented Feb 4, 2017 at 13:48

1 Answer 1


You can either use a filter in your functions.php file:

function mytheme_nav_menu_css_class($classes, $item, $args) {
  if($args->theme_location == 'secondary') {
    $classes[] = 'your-class-name';
  return $classes;

Or if you go to your WP Admin, click Appearance -> Menus and then click the tab at the top "Screen Options", you can tick CSS Classes which will enable you to add a class to each list item in your menu.

See this article for details.


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.