Misleading behaviour on Menu & Theme location


I’ve got the following usual menu registration function:

function my_register_menus(){
    register_nav_menus( array(
        'primary-menu' => __( 'Primary Menu', 'text_Domain' ),
        'footer-menu'  => __( 'Footer Menu', 'text_Domain' ),
    ) );

add_action( 'init', 'my_register_menus', 0 );

and this is what I call in my header.php:

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

Now, in the

WP Admin > Nav Menus

when I assign a menu to the primary-menu location, the menu doesn’t show at all in the theme.

If I un-check the menu location, the menu appears.

, , Paolo Sacchetti 4 years 2020-03-27T08:51:29-05:00 0 Answers 98 views 0

Leave an answer