Menu Item Limit

If you’re finding it impossible to add more items to your menu, or you’re finding that menu settings are not being correctly applied, then you’re probably running into the WordPress menu item limit.

This problem is not directly related to Max Mega Menu or WordPress. Max Mega Menu uses AJAX to save menu item settings and does not affect the overall number of menu items you can save.

This article may be useful to you even if you do not have Max Mega Menu installed.

Symptoms of the Menu Item Limit being reached

On a standard WordPress installation, on a standard server, with no plugins installed you will start reaching the menu item limit once you have added around 90 items in your menu. If you use menu plugins which add fields to each menu item, then the limit will be reduced (note: Max Mega Menu does not add fields to each menu item).

Once you reach the menu item limit, you will start noticing strange behaviour with your menus, including:

  • Menus become untagged from their theme locations
  • Menus lose their hierarchy (menu structure gets flattened)
  • It becomes impossible to add new items to your menu

Why it happens

The problem is down to a server setting called max_input_vars. This setting is described as “How many GET/POST/COOKIE input variables may be accepted [by your server]”. The default value is 1000.

Each item in your menu accounts for roughly 11 “inputs”. With a server limit of 1000 inputs, and each menu item taking up 11 inputs, this means you can save around 90 menu items before you start hitting the limit. However, if you have a plugin installed which adds fields to each menu item then the number of items you can save will be reduced.

How to check the limit on your server

Install the WordPress phpinfo() plugin, and go to Tools > WordPress phpinfo(). Search for ‘max_input_vars’.

max-input-vars

1000 is the default max_input_vars value.

How to increase the limit

cPanel

If your host gives you access to cPanel, head to the “PHP Variables Manager” page.

 

cpanel-php-variables-manager

On the next page, click the ‘public_html’ folder and add the max_input_vars setting.

cpanel-php-variables-manager-2

Check the phpinfo() plugin page after making any changes to ensure the limit has been correctly increased.

.htaccess

Depending on how your host has configured your server, it might be possible to change the max_input_vars value by adding the following line to your .htaccess file:

Check the phpinfo() plugin page after making any changes to ensure the limit has been correctly increased.

VPS and Dedicated Servers

You can adjust the max_input_vars setting in your php.ini file (make sure you restart apache/your web server after changing any values in php.ini).

max-input-vars-php-ini

I’ve made the change, what next?

After making any of these changes, it is important to check the phpinfo() plugin page again to ensure your change has been applied.

My changes aren’t being applied

If you do not have access to any of these options (or they don’t work) you will need to get in touch with your host and ask them to increase the max_input_vars setting.

Please note: “max_input_vars” is a server configuration setting, therefore it is only possible to change this by reconfiguring your server. It is not possible for us to raise the limit by changing the plugin code, you must contact your host for them to adjust this server configuration option.

Related Articles