Nav Menu: Theme Location not working

Question

Why does my created Menus on the WordPress Admin dashboard appear in customtemplate.php DESPITE not defining it the correct ‘theme_location’?

It will show in that location EVEN if the created menu in the WordPress Admin dashboard is not set to show in any location.

It only hides if the following if check is tested. Why?

if(has_nav_menu('menu-ID1'))

Functions.php

register_nav_menus(
            array(
                'menu-ID1' => __( 'MenuName', 'blabla' ),
            )
        );

customtemplate.php

//Still displays even though the registered menu-ID1 is not used    
wp_nav_menu(['theme_location' => 'randomname']);
0
Valeron 2 months 0 Answers 10 views 0

Leave an answer