How to remove the limit to WordPress menus • WordPress Help

As we saw some time ago there is a limit on the amount of items you can add to a custom WordPress menu something that is not determined by the WordPress itself but by the server where it is hosted.

This amount, in some cases can be around 50 items and in others 100 but it can vary depending of the configuration of your server, and in particular of Suhosin an advanced PHP protection system that is used in many servers.

Specifically, there is a variable determined by Suhosin that limits the maximum amount of elements that can be saved using PHP scripts, causing this limit on the number of items you can add to a menu in WordPress .

Okay you should not go crazy with the menus and add dec elements but on some websites is essential to offer visitors access to multiple sections such as on news websites, with sub-menus by provinces, categories and subcategories, so it's not that weird

As we saw some time ago, you can modify the parameter that causes this limitation by modifying the PHP.INI file but we will not always have access to this parameter, so let's see some other more accessible solution for the common mortals, especially if we are hosted on shared servers, where there is normally no access to the PHP configuration .

As usual, there is a code that we can add to the file ] .htaccess for skip the limit of WordPress menu items that the server puts us through Suhosin.

Just add this line to your file .htaccess located in the root folder of your WordPress installation:

If that was not enough you could upload it ( reasonably) up to 10,000 normally.

Now, this modification will not always work. In that case you should refer to try remove the limitation from PHP.INI or go to the next method if you have it available.

You rarely find hosting providers that offer a utility to configure the parameters of PHP If this were your case, simply access this utility and modify the values ​​of the parameter max_input_vars to a value where you will not have problems adding as many menu items as "you need".

In the case of ] CDmon you can do it from the section Configure Server of the user panel, specifically in the icon called Configure PHP . There you will find the site where to upload the parameter max_input_vars from the initial values ​​of 1,000 up to the usual limit for shared servers of 10,000, normally more than enough.

You must bear in mind that it is never good to take the limit the configurations of the server, and that increasing the benefits on the one hand can result in an unexpected loss of resources in another aspect, so use this type of tricks only if absolutely necessary, and always aware of possible side effects.

NOTICE : this publication is from two years ago or more. If it's a code or a plugin it might not work in the latest versions of WordPress, and if it's a news story it might be obsolete. Then do not say we have not warned you.

Loading …

That may also help you: