Opened 11 years ago
Closed 10 years ago
#29927 closed defect (bug) (worksforme)
wp_nav_menu shows wrong menu when menu_id is set
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.0 |
Component: | Menus | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
I have a site that is/was running 3.5.1.
It had the following code:
<?php wp_nav_menu( array( 'menu' => 'Medical Category Menu', 'menu_class' => 'row-fluid Product main_s_cat', 'items_wrap' => '<ul id="%1$s" class="row-fluid Product main_s_cat">%3$s</ul>', 'menu_id' => 'main_cat_menu', )); ?>
After upgrading to 4.0 the wrong menu was shown.
Removing the line with menu_id shows the correct menu.
Steps to reproduce(sorry for formating. i did not get it right. [Correct here]
// how to replicate: // 1. Create at least two menus // 2. Add code below to functions.php or use wp_nav_menu in theme file. add_action('loop_end', function(){ wp_nav_menu(array( 'menu' => 46, // make sure its an menu id that exist 'menu_class' => 'row-fluid Product main_s_cat', 'items_wrap' => '<ul id="%1$s" class="row-fluid Product main_s_cat">%3$s</ul>', 'menu_id' => 'main_cat_menu', //with this line in place, correct menu is NOT shown. Remove it, and correct menu is shown... )); });
I included the add_action as an easy way to test if not editing theme files... its the same if added directly into theme.
Change History (4)
Note: See
TracTickets for help on using
tickets.
Tested with 2 menus and 3 menus, passing each menu ID into the 'menu' parameter and was unable to reproduce this bug. Each menu ID displayed the correct menu, with our without the 'menu_id' parameter in place. Please provide additional information in order to reproduce.