Fixing the menu item limit issue in WordPress

Some users have reported the menu item limit issue: The issue is that WordPress does not allow more than a certain number, say n menu items, n varying under various environments. Quite often, this issue is misunderstood as an issue originating from the theme or as an issue with WordPress. Let us try to understand why this issue happens.

Explanation

This problem is neither caused by the Customizr theme nor entirely by WordPress. The limit n is not fixed for all and it differs in different environments. It is the web server that limits the number of menu items. The Suhosin limitations on the POST max variables limit the number of menu items that can be saved.

What is Suhosin?

Suhosin is an advanced protection system for PHP installations. It was designed to protect servers and users from known and unknown flaws in PHP applications and the PHP core. Suhosin comes in two independent parts, that can be used separately or in combination. The first part is a small patch against the PHP core, that implements a few low-level protections against buffer overflows or format string vulnerabilities and the second part is a powerful PHP extension that implements numerous other protections.

There are two ways to fix the Suhosin variables so as to enable larger number of items to be saved using PHP scripts. In most cases, one of these fixes should remove the menu item limit.

Fix 1 - .htaccess

Edit the .htaccess file in the home directory of your WordPress installation.

Add the following line:
php_value max_input_vars 5000

This should automatically remove the menu item limit. If the issue still exists, try changing 5000 to a higher number or try the second fix.

Fix 2 - PHP.ini

Edit the PHP.ini file. If your server is a dedicated server or a VPS, then you can easily access the file. But if you are on a shared hosting, do check with your web hosting provider.

Add the following lines:
 suhosin.post.max_vars = 5000
 suhosin.request.max_vars = 5000
or this line:
max_input_vars = 5000

Restart the server if necessary.

If the problem persists, contact the technical team of your web host.