Menu Item Limit

Knowledgebase Docs » UberMenu 3
USEFUL? 68
UberMenu 3

Please note that this is not an UberMenu issue – the same issue will occur with or without UberMenu. It is a server configuration issue. Unfortunately, there is nothing UberMenu can change to fix the issue. You’ll have to work out the solution to remove the POST vars limitation on your server or with your host. This FAQ is intended to point you in the right direction.

Some users will experience a limit to the number of menu items they can add to their menus. This manifests when a user tries to add more items than the server can handle, which results in any items beyond the limit being truncated from the end of the menu. So if the limit is 100 and the user adds 5 additional items, the final 5 items in the menu will be deleted.

Please note that this limit is not imposed, or caused by, UberMenu. The same issue occurs with or without UberMenu.

This limit is caused by a server configuration issue. In a nutshell: the server has a (configurable) limit to the number of variable that can be received, and when WordPress sends more than this limit when trying to save a large menu, any variables over the limit will never been seen by WordPress. As a result, WordPress deletes the related items.

Note that another common symptom of this issue since WordPress moved the theme location assignments below the menu items in Appearance > Menus, is that your menu will become unassigned from your theme location for the same reason – that data isn’t received, so WordPress assumes the box was unchecked.

For your reference, here is an official WordPress core trac ticket on the subject.

For a full technical explanation and in-depth analysis on the subject, please refer to my detailed article:
The WordPress Menu Item Limit or: Help! Half my menu items just disappeared!

max_input_vars

The most common issue stems from the max_input_vars PHP directive, which was introduced in PHP 5.3.9. By default, max_input_vars is set to 1000, which can easily be reached with the WordPress menu system, since each menu item sends about 12 variables per item.

Solution

The solution is to simply configure the max_input_vars so that it is large enough to handle the number of variables being sent by WordPress to save your menu.

php.ini

If you have access to your php.ini, you can just add this directive (or change the value of the existing directive) to includes your max input variables:

max_input_vars = 3000;

If you don’t have access to this file (as with many shared hosts), you may need to contact your host to increase this limit.

.htaccess

Alternatively, you can try placing this in your .htaccess. This won’t work on some servers, so your mileage may vary.

php_value max_input_vars 3000
.user.ini

If you have a .user.ini file, you can add the following to override the default php.ini value

max_input_vars = 5000;

Suhosin

This issue is less common, nowadays, but the issue can also occur due to a program called Suhosin which runs on your server. This is a known issue with WordPress, and affects both the standard WordPress Menu System, as well as UberMenu, which is built on top of that system.

In most cases, the solution is as simple as asking your host to increase the max_vars variables in your php.ini.

suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000

If you don’t have access to php.ini

If you’re on shared hosting, you may not have access to the php.ini. In most cases, it is best to contact your host to have them change these values if you are not able to do so yourself. However, on some hosts you can adjust these values in files that you have access to. If these solutions do not work and you do not have access to your php.ini, you’ll need to contact your host to make the changes.

In some cases, hosts have refused to make this change. I suggest sending them the trac ticket and this very detailed article. If that does not convince them that they should increase this limit, as they are artificially restricting the capabilities of their WordPress customers, it’s probably time to think about changing to a better host. Unfortunately, if they won’t let you increase this limit, there’s nothing left to be done to solve this issue – you might try the workaround below.

A Workaround

If for some reason you can’t increase your variable limit, you can use this workaround. Break your menu down into smaller parts and combine them via the Menu Segment functionality in UberMenu 3. As long as each segment stays below the limit, your menu should be able to function.