How to Fix the Custom Menu Items Limit in WordPress

Just a few days ago, one of our users reported an unusual problem. The problem was that he was reaching the custom menu items limit. Anything he saves after he reached the menu item limit would not save at all. We had never heard of this problem, so we decided to give it a try on our local install. Created 200+ menu items and saved it. It worked just fine. Moved 100 items into a dropdown and that saved perfectly fine. At that point, we knew that this had something to do with the server.

Upon further research, it seemed that many others were having the same issue. Digging a little deeper, we found a trac ticket (#14134) that highlighted this problem. After reading the very very long trac ticket, it seems that the problem has not been fixed yet, but there is a work around fix for those who are having this issue. In this article, we will show you how to fix the custom menu items limit in WordPress.

To fix the issue, you need to edit your PHP.ini file. If you are on a dedicated server or on a VPS with root access, then you should already know what we are talking about. If you are on a shared hosting or don’t know where PHP.ini file is, then ask your web hosting provider to do this for you.

You need to ask them to set the following values in the PHP.ini configuration:
1suhosin.post.max_vars = 5000
2suhosin.request.max_vars = 5000

Another user “ronnieg” posted a work around that he has for his large (450+ pages and growing) real estate site and menu. You can read his response to follow along. (Note: we haven’t tried this one)

Explanation of the Problem

This problem is not entirely WordPress based as different folks are seeing different limits (some say 16 others say 50 and as you already know we went as high as 200 without seeing any limits). In theory, WordPress is not limiting the number of menus you can have. Your web hosting server is.

There are Suhosin limitations on the POST max variables which is limiting the large number of entries being saved. Nacin replied in the trac ticket to say that this is NOT a bug rather it is an enhancement. The core team has to find a way to work around the server limitations and figure out a better way to save the menu items, so regardless of your server configuration you do not see any custom menu limits. It’s easier said than done.

WordPress is an open-source (voluntary) project, and the core team does everything they can to improve it every day. This will be fixed, but the timeline isn’t defined yet as it says “Future Releases”.

If you have tried something different that fixed this issue for you, then please let us know in the comments. This will allow others to fix their issue until the core team finds a work around.
source: wpbeginner.com

Comments