Title: wp_nav_menu() &#039;menu_class&#039; usage? (bug?)
Last modified: August 19, 2016

---

# wp_nav_menu() 'menu_class' usage? (bug?)

 *  [DMackCA](https://wordpress.org/support/users/dmackca/)
 * (@dmackca)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/wp_nav_menu-menu_class-usage-bug/)
 * Hello,
    I’m trying to set the class on the **ul** element generated by the **
   wp_nav_menu** function.
 * I’m using this php code:
    `<?php wp_nav_menu(array('menu_class' => 'menuclass','
   container_class' => 'containerclass')); ?>`
 * I’d expect it to apply ‘menuclass’ to the ul, and ‘containerclass’ to the container
   div… But it doesn’t. It prints like this:
 *     ```
       <div class="menuclass">
       <ul>
       <li class="current_page_item"><a title="Home" href="#">Page 1</a></li>
       <li><a href="#">Page 2</a>
       </ul>
       </div>
       ```
   
 * Is this a bug in the way the function works, or is the documentation incorrect?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [lessthanweb](https://wordpress.org/support/users/lessthanweb/)
 * (@lessthanweb)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/wp_nav_menu-menu_class-usage-bug/#post-1636360)
 * Yup, having the same problem.
 * If the menu (WP admin area) is not set, then the “menu_class” is applied to “
   container”.
    In other words, it overwrites the “container_class”.
 * If the menu is set, then the “menu_class” is applied to “ul”.
 * I’m guessing this is a bug as it doesn’t make any sense at all.
 *  [lessthanweb](https://wordpress.org/support/users/lessthanweb/)
 * (@lessthanweb)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/wp_nav_menu-menu_class-usage-bug/#post-1636361)
 * Ah, its because of the fallback to wp_page_menu function if there is no menu 
   set.
 *  [aguimaraes](https://wordpress.org/support/users/aguimaraes/)
 * (@aguimaraes)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/wp_nav_menu-menu_class-usage-bug/#post-1636459)
 * You are right, it’s because of the fallback to wp_page_menu.
 * But, how can I set options for wp_page_menu when wp_nav_menu falls back?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘wp_nav_menu() 'menu_class' usage? (bug?)’ is closed to new replies.

## Tags

 * [wp_nav_menu()](https://wordpress.org/support/topic-tag/wp_nav_menu/)

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 3 replies
 * 3 participants
 * Last reply from: [aguimaraes](https://wordpress.org/support/users/aguimaraes/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/wp_nav_menu-menu_class-usage-bug/#post-1636459)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
