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 register 2 menus in my functions.php file:

register_nav_menus(array(
    'main_menu' => 'Main Menu',
    'bottom_menu' => 'Bottom Menu'
));

I populate a menu in the admin and assign the theme location:

Assigning menu location

I call the menu in my theme:

<?php
    wp_nav_menu('menu', 'main_menu');
?>

After doing all this, bottom_menu is the menu showing up in my theme instead.

Can anyone tell me what I'm doing wrong? Either I'm missing something really silly here or Wordpress is giving me the finger.

share|improve this question
1  
wp_nav_menu() takes array of arguments, see usage examples in documentation. –  Rarst Nov 22 '13 at 15:28
    
Resolved! It was the theme_location argument. –  Eoghan OLoughlin Nov 22 '13 at 15:42
add comment

1 Answer 1

By specifying a theme_location argument in my array, the issue was fixed:

wp_nav_menu(array(
    'theme_location' => 'main_menu'
));

Edit

For a distributed Theme, do not pass the 'menu' parameter to the wp_nav_menu() call. It will look for a specific slug of a user-created menu, and will override 'theme_location'. Only ever pass 'theme_location'.

share|improve this answer
    
Ah ok I wasn't aware of that, thanks Chip. –  Eoghan OLoughlin Nov 22 '13 at 17:17
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.