WordPress.org

Support

Support » How-To and Troubleshooting » wp_nav_menu only works with menu=>description

wp_nav_menu only works with menu=>description

  • wilrevehl
    Participant

    @wilrevehl

    As far as I can tell, the wp_nav_menu ‘menu’ argument only returns the correct menu if you give it your description from when it was registered, not the menu slug. Has anyone else experienced this, or is my implementation wrong?

    functions.php
    register_nav_menus(
    		array(	'primary' => 'Primary',
    				'footer1' => 'Footer Column 1',
    				'footer2' => 'Footer Column 2'
    			)
    		);
    
    footer.php
    <?php wp_nav_menu( array( 'menu' => 'footer2' ) ); ?> = DOES NOT WORK
    <?php wp_nav_menu( array( 'menu' => 'Footer Column 2' ) ); ?> = WORKS!
Viewing 1 replies (of 1 total)
  • seagyn
    Participant

    @seags

    Your implementation is correct. The first argument or in your case the array key is the location and the second is description. ‘menu’ associates with the description and ‘theme_location’ associates with the location.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_nav_menu only works with menu=>description’ is closed to new replies.