Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to get the menu on my WordPress site to append the class like so:

<ul class="nav navbar-nav navbar-right">
    <li><a href="/">Home</a></li>
    <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Subjects <span class="caret"></span></a>
        <ul class="dropdown-menu" role="menu">
            <li><a href="#">A Subject</a></li>
            <li><a href="#">Another Subject</a></li>
            <li><a href="#">Something else here</a></li>
            <li class="divider"></li>
            <li class="dropdown-header">Nav header</li>
            <li><a href="#">External link</a></li>
            <li><a href="#">Sign in to externalmemberssite.net</a></li>

But I end up with this:

<div class="nav navbar-nav navbar-right">
        <li class="page_item page-item-2">
            <a href="http://mysite.org/sample-page/">Sample Page</a>

Then this is the PHP code to generate the menu:

$defaults = array(
    'menu_class'        => 'nav navbar-nav navbar-right',
    'items_wrap'        => '<ul id="%1$s" class="%2$s">%3$s</ul>'

wp_nav_menu( $defaults );
share|improve this question
This is a little disjointed. What do you mean by "append class" precisely? –  Rarst Jul 10 '14 at 17:45

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.