I'm building a theme, in which, I have 2 menus:

  1. Footer menu (footer-menu)
  2. Main menu (main-menu)

However, when I called the main one in the header.php file it uses the same links added in the footer navigation.

Please see my code.

Registering the navs

register_nav_menus( array(
        'main-menu' => esc_html__( 'Main', 'wd' ),
        'footer-menu' => esc_html__( 'Footer', 'wd' ),
    ) );


<?php wp_nav_menu('main-menu'); ?>


<?php wp_nav_menu('footer-menu'); ?>

What am I doing wrong? This has never occured before. Ever.

  • Did you assign the menus in Menus > Manage Locations ? If no menu is selected for this menu position it reverts to the default menu. So on this page both dropdowns need to be 'filled'.
    – Beee
    Commented Mar 23, 2018 at 17:18
  • I did indeed. Still not working. Commented Mar 23, 2018 at 17:20

2 Answers 2


Just the fact that they have the same name doesn't mean that WP knows the menu "main-menu" goes in the location "main-menu". You will have to specify this, as you can see from the source code of wp_nav_menu:

$args = array (
  'menu'           => 'main-menu',
  'theme_location' => 'main-menu',
wp_nav_menu ($args);

wp_nav_menu expects an array of arguments, not a string. If main-menu and footer-menu are theme locations, then you need to specify that in your arguments:

wp_nav_menu( array( 'theme_location' => 'main-menu' ) );

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.