trouble-shooting » Archive

Navigation Menus

I recently ran into an issue where the Menus’ admin page (/wp-admin/nav-menus.php) was showing a 404 error. I had just added support for menus in the function file and figured that must be it. I deleted all my changes, still broken. I redid the menu 3 different ways, still broken.

I found this core ticket and tried a few things it mentioned ↓

Menus are sometimes limited in the number of items they can have – I had a LOT of pages and categories because I had imported the Theme Unit Test data – plus added content of my own. The default menu was pulling in everything which pushed the count way up. I went in to the Categories page and deleted all but 5, still broken. Then I deleted a bunch of pages, still broken.

I switched to the Twenty Eleven theme to make sure it wasn’t a theme issue, still broken.

Several comments suggested it could be a host problem, more specifically with the suhosin.post.max_vars and suhosin.request.max_vars setting which limits the number of variables allowed. I found my host php.ini file in the root directory and added:

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

The page was now giving me a Server Error instead of a 404 Error, different but still broken!

FINALLY I look in my database through PhpMyAdmin. I clicked on the wp_terms table and all of the category items I had deleted were still in the database. Huh! I manually deleted the terms I’m no longer using and headed back to /wp-admin/nav-menus.php → PROBLEM SOLVED!

Of course, it won’t always be possible to just delete pages and categories. Check out the comments on the core ticket I mentioned above – as well as ‘How to Fix the Custom Menu Items Limit in WordPress‘ on wpbeginner.com for a few different solutions.