[wp-trac] [WordPress Trac] #32699: Menus Administration screen, notice error when adding an item

WordPress Trac noreply at wordpress.org
Thu Jun 18 09:46:04 UTC 2015


#32699: Menus Administration screen, notice error when adding an item
--------------------------+-----------------------------
 Reporter:  imath         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Menus         |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When not using the customizer to set a nav menu, adding a new menu item is
 generating this notice error :
 `Notice: Undefined index: menu in pathto\wp-admin\includes\ajax-
 actions.php on line 1137`

 That's because in `/wp-admin/js/nav-menu.js` the function addItemToMenu
 tries to get the `#menu` ID that is not existing if there is less than one
 menu to edit. In this case the select box to select a menu to edit is not
 displayed.

 In other words, if you have this select box (more than 1 nav menu) :
 [[Image(https://cldup.com/RPT2CdjqP9.png)]]
 There is '''no''' notice error.

 But if you have no nav menu or only one, this select box doesn't appear
 and you only have this :
 [[Image(https://cldup.com/uAFCtb-JBS.png)]]
 In this case '''you get''' the notice error

 Before 4.3 dev cycle, there was a `#menu` ID in an hidden field of the
 `form#update-nav-menu`. I guess it has been removed due to duplicate ids
 as soon as the select box appears.

 Using the attached patch seems to fix the issue.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32699>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list