Fixing the WordPress menu items limit

WordPress can be a strange beast sometimes. This is one issue that’s haunted it for a long time, and is still around today.

WordPress’s internal menu system sets up every menu item with somewhere between 11 and 15 separate fields. That’s for each menu item. Under some circumstances this isn’t too bad. Problems occur on most shared servers when the setting for max_input_var is set to 1,000. This means that you are effectively limited to a menu that’s a bit less then 100 items in total. There’s some sites that I administer that have a lot more then that.

Now the solutions…

Fixing the WordPress menu items limit – option 1

This is the easy one, and the one that most people will use.

You need to create a php.ini file in the /wp-admin/ folder with these lines:

<IfModule mod_php.c>
php_value suhosin.simulation 1
php_value suhosin.memory_limit 128M
php_value 5000
php_value 5000
php_value suhosin.request.max_vars 5000
php_value suhosin.request.max_input_vars 5000

max_input_vars = 5000 = 5000
suhosin.request.max_vars = 5000
php_value max_input_vars 5000

That will tell the server to increase it’s limits

Fixing the WordPress menu items limit – option 2

This one’s harder, so a lot less people will attempt it.

The solution is to use your own custom menu walker. By doing this you can break into the menu structure at any point and add in whatever items you need to.

There’s up sides and down sides to this method, but it’s probably the most reliable over time.

Leave a Reply

Your email address will not be published. Required fields are marked *