How to increase the Menu items limit in WordPress
Have you reached the max items menu/custom meta rows limit on WordPress? When you add more than a certain amount of menu items/custom meta rows do they just delete on saving? This tutorial will show you to increase this limit and explain what’s causing it.
Why can’t I add more Menu items/custom meta rows?
The reason that you can’t add any more menu items/custom rows to your WordPress menus is that of your server settings. There was a new php.ini option added called ‘max_input_vars’ in the PHP 5.3.9 update. ‘Max_input_vars’ controls the maximum amount of input variables. This is to help protect against denial of service attacks. Most servers will be set to 1000 ‘max_input_vars’, this is roughly around 90 menu items/45 post custom meta rows.
How to tell what your ‘max_input_vars’ value is?
The best way to tell what your max_input_vars is to create a phpinfo.php file and upload it to your server. The ‘phpinfo’ file will tell you what your PHP server settings are.
- Create a file called phpinfo.php
- Add this line of code into the phpinfo.php file
<?php phpinfo(); ?>
- Upload phpinfo.php to your server
- Navigate to where you uploaded it on your server for example www.example.com/phpinfo.php
- Scroll down to till you find max_input_vars and the number beside it is what your server will be set at.
**It’s good practice to delete this file after as you don’t want others to see it**
How to check your ‘max_input_vars’ limit with Woocommerce
Alternatively, if you have Woocommerce installed you can check by:
- Logging to the WordPress admin section
- Go to Woocommerce
- Then click on system status
- Scroll down until you see PHP Max Input Vars
Increasing your ‘max_input_vars’ value
The best way I’ve found to increase your ‘max_input_vars’ value is to:
- Connect to your site via FTP or File Manager
- Navigate to wp-admin folder
- Create a file inside the wp-admin folder called php.ini
- Add in this line:
max_input_vars = 5000
- Save
Also, you can use an easier way which pointed on the screenshot. Change your .htacces file:
Check to see if your ‘max_input_vars’ has changed
Finally, check to see it has worked and if you need to add more menu items/custom meta rows just increase the ‘max_input_vars’ value to whatever you need.
**It’s good practice to delete the phpinfo.php file after as you don’t want others to see it**