Fix Menu Exceed Problem In WordPress
How to solve menu exceed problem in WordPress, if you are trying to add more than 100 menu items then it will be a problem because with default php configuration you can’t add more than 90 menu items. If you have long menu then you should update “max_input_vars” in php configuration file. You can fix this issue in different method below you can find clear explanation about WordPress menu limit problem.
By default the php variables are limit to 1000. Here you need to customized the “max_input_vars” in php configuration based on your menu requirement. If menu exceeds more than 1000(size), then items more than 90 will be removed automatically after saving the menu in WordPress.
Steps to fix WordPress menu limit problem
Before proceeding further, this is simple calculation to find out maximum number menu items you can add in WordPress menu’s.
max_input_vars >= 11 * “Number of menu items” +9
The default value of max_input_vars is 1000.
so 1000 = 11 *(x)+9
1000 = (11*x)+9 (as per DMAS Rule)
x=90(it takes floor)
If you want to use 180 menu items in WordPress menu’s, then set “max_input_vars” to 2000. Now you got the calculation.
May you got the question that is where and how could I made the changes? The answer is based on versions,hosting types.
1. Steps to fix in local web server
If you are using WAMP/XAMP/LAMP/MAMP in your local machine, then you can follow this procedure to fix the issue.
- Go to php directory in WAMP/XAMP/LAMP/MAMP, and find php configuration file it will be named as “php.ini” file.
- Check weather the following code exist or not
;max_input_vars = 1000" it will available since PHP 5.3.9.
3.Update the value based on above calculations (How many number of menu items required for you in WordPress menus)
Note: In local web server, By default the peace of code is ;max_input_vars = 1000 will have a semicolon in front of it remove the “;” in front of “max_input_vars = 1000” and update the value.
Semicolon is a comment in php configuration(php.ini) file.
2. In Godaddy web hosting
If you are using godaddy web hosting, then you can follow these steps to increase “max_input_vars” in php configuration.
For Hosted server there is no php.ini file for individually. So create .user.ini file at root directory.
- Navigate to public_html (www) directory in your webhosting cpanle or using ftp like filezilla.
- Make a new file with file name .user.ini dont make mistake like user.ini,make as same as follow(.user.ini)
- step3. write a peace of code into that file and save at root directory(www or public_html ).
max_input_vars = required menu items size (2000 or 3000).
If the above methods didn’t work for you, then you can try this code using htaccess file.
3. Using htaccess file
From the PHP Version PHP 5.3.9 starts “max_input_vars”(Which is same as Suhosin’s post.max_vars).
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.
To know the version of PHP is
<?php echo ‘Current PHP version: ‘ . phpversion(); ?>
It will be solved by increasin the size of “max_input_vars” in htaccess file
- Navigate to public_html (www) directory in your webhosting account cpanl.
- Create a new file with file name .htaccess, edit it if you have this file
- Write a peace of code into that file and save at root directory(www).
php_value max_input_vars 5000 php_value suhosin.get.max_vars 5000 php_value suhosin.post.max_vars 5000 php_value suhosin.request.max_vars 5000
- It will works fine in any case if it’s not working update the code as below
max_input_vars 5000 suhosin.get.max_vars 5000 suhosin.post.max_vars 5000 suhosin.request.max_vars 5000