• Hi everyone.

    Quick question about the behavior of the wp_nav_menu function. The codex says :

    Given a theme_location parameter, the function displays the menu assigned to that location, or nothing if no such location exists or no menu is assigned to it.

    If not given a theme_location parameter, the function displays

    * the menu matching the ID, slug, or name given by the menu parameter, if that menu has at least 1 item;
    * etc.

    In my experiments however, “menu” seems to be taking precedence over “theme_location” if both are declared. The following code outputs the “Primary Navigation” menu as defined via the admin panel, not the menu actually associated with the registered “footer_menu” location in said panel.

    wp_nav_menu( array(
    	'menu' => 'primary-navigation',
    	'theme_location' => 'footer_menu',
    	'fallback_cb' => ''
    ) );

    This seems inconsistent with the doc.

    I know it’s not a big deal, but am I missing something ?

    Thanks in advance for your help !

Viewing 2 replies - 1 through 2 (of 2 total)
  • If not given a theme_location parameter

    If you specify a theme_location parameter, it simply overrides the menu parameter ?!

    Thread Starter bbross

    (@bbross)

    Thanks for your reply.

    As a matter of fact, it doesn’t seem to do so. On the contrary : the “menu” parameter seems to override the “theme_location” parameter when both are declared. See my example above.

    Am I not seeing the elephant in the room or is there indeed some inconsistency in the Codex ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_nav_menu : theme_location vs. menu parameters’ is closed to new replies.