WordPress – Apperance > Menu

If you check the codex documentation page about the wp_nav_menu you will see that there is a param called menu, and that will allow you to target a specific menu.

As pointed on the documentation you can check this:

wp_nav_menu(
    // Use this menu
    'menu' => 'Project Nav',

    // do not fall back to first non-empty menu
    'theme_location' => '__no_such_location'

    // do not fall back to wp_page_menu()
    'fallback_cb' => false
);

But if you want to register a place I mean theme_location, you need to register_nav_menu then a new Widget will appear on the Appearance tab and you will be able to select which menu goes to that location registered.


You just need to place this on your theme functions.php and head over to the “Appearance” > “Menu” on the WordPress Admin and select the menu you want to be assigned to the Primary Menu.

add_action( 'after_setup_theme', 'q166543_register_menu' );
function q166543_register_menu() {
    register_nav_menu( 'primary', 'Primary Menu' );
}

Then head over to the place you want to display the menu and paste the following code:

wp_nav_menu(
    'container'      => false,
    'theme_location' => 'primary',
    'exclude'        => '479',


    // do not fall back to wp_page_menu()
    'fallback_cb' => false
);