0

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.

3
  • Try doing a single menu function single_menu_reg() { register_nav_menu( 'primary-menu', __( 'Primary Menu', 'text_domain' ) ); } add_action( 'init', 'single_menu_reg', 0); - this is just a test to see if something else is happening. As your code looks fine.
    – disinfor
    Commented Mar 27, 2020 at 19:14
  • Hello @disinfor I've also tried the single register_nav_menu menu function but nope, same behaviour: when I assign the menu to that location the menu disapper, if I uncheck the location for the menu, it appears again. That's weird, I can't figure out what I'm missing. I also use Polylang, so I thought that had something to do with it, but I don't know... Commented Mar 28, 2020 at 15:45
  • Then you need to start troubleshooting. Deactivate all your plugins and activate them one by one until your menu breaks. Without seeing more code, I don't think we can necessarily help - since what you posted should work.
    – disinfor
    Commented Mar 29, 2020 at 15:07

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.