WordPress.org

Ready to get started?Download WordPress

Forums

wp_nav_menu only works with menu=>description (2 posts)

  1. wilrevehl
    Member
    Posted 3 years ago #

    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!
  2. Seags
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic