Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#32344 closed defect (bug) (duplicate)

Menu items in large menus disappear unexpectedly in wp-admin/nav-menus.php on most default server configurations

Reported by: zuige's profile Zuige Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.3
Component: Menus Keywords:
Focuses: administration Cc:

Description

Issue

Due to the way nav-menus.php handles a save action, the maximum number of menu items in a single WordPress navigation menu is limited to 83 on default php.ini settings on most modern server configurations.

The ini setting that affects this behaviour is max_input_vars. The default value on many configurations I've tested is 1000.

Steps to reproduce

1. Create a new menu

Done here with wp-cli:

wp menu create "Big Menu"

2. Manually add 100 custom menu items.

As shown here with wp-cli:

for i in {1..100}; do wp menu item add-custom 3 item-$i "#"; done

3. Navigate to wp-admin/nav-menus.php and load up the edit menu screen.

4. Hit "Save Menu" and Boom; only 83 menu items remain, depending on your max_input_vars value.

Remediation

UX improvement: We should warn the user if the number of the resulting POST data entries exceeds the local max_input_vars value before submitting the "Save Menu" action.

There's a plugin by Sevenspark that warns if the menu size is near the limit: https://github.com/sevenspark/menu-limit-detector

or

Actual fix: We should pre-process the submit data from inputmenu-item-*? form fields on the browser side to raise the upper limit to something less likely to be reached.

One solution would be to just store the inputmenu-item-*? fields in a single POST item.

Alternatively, we could serialise the fields from each menu item in its own key, which would raise the limit to somewhere close to 1000 items / menu.

I'm working on a patch for this right now. Comments?

Related issues

#32009
#14684
#14134

Change History (2)

#1 @DrewAPicture
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14134.

#2 @SergeyBiryukov
9 years ago

  • Component changed from General to Menus
Note: See TracTickets for help on using tickets.