How to Fix the Custom Menu Items Limit in WordPress

How to Fix the Custom Menu Items Limit in WordPress

If you are going to add too many menu items in your WordPress then beware, on saving your menu you will lost menu items that are beyond WordPress menu items limit. This thing had happened to us and we did a lot of extra work to add those menu items again but only after increasing this limit.

This limit is not imposed by WordPress but by your web hosting server because of some security reasons. In PHP, there is a thing called post vars that controls menu items. By default maximum post vars are much limited as most of the websites require only a few menu items. But if you are running a big news website, or an eCommerce website most probably you will need to have several menu items in your menu.

It is very easy to increase number of post vars using php.ini

All you need to do is adding a piece of code in your php.ini file. Keep in mind that different web hosts support different kind of methods and we have listed all here;

Increasing max_input_vars

To increase input_vars add the following code in your php.ini file

max_input_vars = 3000;
Note – Create a text file name php.ini and add this code to that file and place this file in your WordPress root. If your host doesn’t support custom php.ini file get their support to add this code ot php.ini file

If your server is using Suhosin

If your hosting server has Suhosin running, it will affect your WordPress menu limit and you need to add the following code in your php.ini file;

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

Other methods

If above given workarounds don’t work, you can also try some other;

1.Add php.ini in wp-admin folder

Create a php.ini file with the below given code and put it into wp-admin folder

max_input_vars = 3000;

2.Add .user.ini file

Create a file .user.ini and add the following code to it and try placing it in WordPress root or in wp-admin folder;

max_input_vars = 5000;

Hopefully one of the method should work for you.

If you are unable to create a php.ini file?

However, it would be a great bullshit if any host doesn’t allow creating custom php.ini files.

Get your Web Hosting support team and ask them to add the code to php.ini file or ask them to enable custom php.ini creation. It may be possible that your host deny to add custom code to php.ini file or to enable creation your own php.ini file. In that condition you should consider switching to a better host as you are free to transfer your website anytime to any host.


On Ubuntu VPS i was able to fix it by uncommenting and setting higher values as below.

max_input_nesting_levels = 500
 max_input_vars = 5000

HostGator Friends – Same Issue & This Solved it:

1. Cpanel > File Manager
2. public_html > wp-admin
3. Click “New File” > name it php.ini (if you don’t have this file already)
4. Click php.ini > click “edit” > click “edit” again
5. Paste: max_input_vars=5000; > Save > DONE

Jayesh Patel
Author
Jayesh Patel

Jayesh Patel is a Professional Web Developer & Designer and the Founder of InCreativeWeb.

As a highly Creative Web/Graphic/UI Designer - Front End / PHP / WordPress / Shopify Developer, with 14+ years of experience, he also provide complete solution from SEO to Digital Marketing. The passion he has for his work, his dedication, and ability to make quick, decisive decisions set him apart from the rest.

His first priority is to create a website with Complete SEO + Speed Up + WordPress Security Code of standards.



Explore

Related Articles

11th April, 2024

W3 Total Cache: A Comprehensive Review & Guide for 2024

8th April, 2024

Top 10 Must-Have Web Design Resources and Tools for 2024

8th April, 2024

Unleash Accessibility Potential in Front-end Development