WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#26047 closed defect (bug) (fixed)

Unable to add menu items to menus

Reported by: butterflymedia Owned by: SergeyBiryukov
Milestone: 3.8 Priority: normal
Severity: major Version: 3.8
Component: Menus Keywords: has-patch
Focuses: Cc:

Description

Unable to add posts/pages to custom menus using Twenty Fourteen. No console error is received.

When clicking on Add to menu, nothing happens.

Attachments (1)

26047.diff (694 bytes) - added by jeremyfelt 8 years ago.

Download all attachments as: .zip

Change History (12)

#1 @Ipstenu
8 years ago

  • Summary changed from Unable to add posts/pages to custom menus using Twenty Fourteen to Unable to add posts/pages to custom menus

This is not just Twenty Fourteen. Tested on Twenty Thirteen and Genesis, same results. Editing title.

The text changed from "Add menu items from the column on the left." to "Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options." but there's no menu box.

Tried pages, posts, categories, links, and all the same result.

#2 @Ipstenu
8 years ago

  • Summary changed from Unable to add posts/pages to custom menus to Unable to add menu items to menus

#3 @helen
8 years ago

Presuming that this is caused by the report in #26058?

#4 @jeremyfelt
8 years ago

#26058 was marked as a duplicate.

#5 @jeremyfelt
8 years ago

  • Component changed from Themes to Menus
  • Milestone changed from Awaiting Review to 3.8

After [26163] for #25953, I see an undefined index 'menu-item' on line 902 of wp-admin/includes/ajax-actions.php when adding nav menu items.

If I disable WP_DEBUG, I get the same behavior described in this ticket description.

Last edited 8 years ago by jeremyfelt (previous) (diff)

#6 @jeremyfelt
8 years ago

Looks to be line 169 in nav-menu.js.

Old: re = new RegExp('menu-item\\[(\[^\\]\]*)');

New: re = /menu-item\[([^]\]*)/;

#7 @senlin
8 years ago

I actually get the error/notice on line 907 of wp-admin/includes/ajax-actions.php:

Notice: Undefined index: menu-item in /path/wp-admin/includes/ajax-actions.php on line 907

#8 @jeremyfelt
8 years ago

@senlin - That's appearing because the ajax call from nav-menu.js is not passing the data for $_POST['menu-item'] that is expected in ajax-actions.php.

Version 0, edited 8 years ago by jeremyfelt (next)

#9 @senlin
8 years ago

I can confirm that before [26163] adding nav menu items works

@jeremyfelt
8 years ago

#10 @jeremyfelt
8 years ago

  • Keywords has-patch added; needs-patch removed

The replacement Regex was slightly off. 26047.diff contains the correct version.

Props to @rzen for the fix.

#11 @SergeyBiryukov
8 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 26233:

Fix replacement regex in wp-admin/js/nav-menu.js.

props rzen, jeremyfelt.
fixes #26047.

Note: See TracTickets for help on using tickets.