[wp-trac] [WordPress Trac] #32344: Menu items in large menus disappear unexpectedly in wp-admin/nav-menus.php on most default server configurations
WordPress Trac
noreply at wordpress.org
Mon May 11 14:48:37 UTC 2015
#32344: Menu items in large menus disappear unexpectedly in wp-admin/nav-menus.php
on most default server configurations
----------------------------+-----------------------------
Reporter: Zuige | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
== 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 ''input
['menu-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 ''input['menu-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
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32344>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list