I came across an issue today where a WordPress menu was being limited to 90 items, and anything beyond that was automatically removed (without warning) when the menu was saved. While this may be an extremely rare issue (as most WordPress site owners are not maintaining navigational menus anywhere near that size), it’s worth noting why it happens and the options available to fix it.
The problem has little to do with WordPress itself but is rooted in PHP and the default configuration found in most php.ini files. There is a configuration directive forÂ max_input_varsÂ that, ultimately, determines how many menu items you can have:
How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request.
The defaultÂ max_input_varsÂ on most web servers is going to be 1000. Based on the resources WordPress menus need, this limits menus to 90 items. The simple (or not so simple, depending on your host) fix is to change this value in your php.ini file. ChangingÂ max_input_vars to 2000 will allow you to place approximately 181 items in your menu (click here for a technical explanation of how these numbers are determined).
Modifying the php.ini file on your web server may not be a viable option, but even if it is, I’d like to propose a better solution: consider redesigning your menus to contain fewer items. If you have a navigational menu approaching 90 items, there is a good chance your menu is overwhelming the user with a situation that is difficult to navigate or maintain a true sense of organization.Â Consider using secondary menus or sidebar menus on sub-pages to help users navigate once they reach sub-sections of your site. Site visitors should be able to reach core sub-pages of your site with a single click, but it’s okay for them to click a second time to reach deeper, more specific information.