So I've been snooping around to see if there has been any change to how menus work in WP, but I haven't found anything yet.

Some of the problems I have expereinced:

  • Menu items still remains in menu after page has been deleted or is no longer published
  • It's not possible to get menu children by parent ID
  • WP gives you 500 Internal Server Error if you have to many menu items and server does not have enough memory

I think the reason for why this is causing so many issues, is that Menu items have their own custom post type (Navigation Menu). Really? A menu item is stored / handled as a post?

Retrieving child menu items should be as easy as get_menu_children($current_menu_id). But alas no. Here we we can run into issues like post-type vs custom-post-type vs custom-menu-item.

At one point I had to use Walker_Nav_Menu.

So my question is, has there been done any improvements on how menus are handled in WP?

  • I can't answer your question but all these problems can definately be avoided (I've never experienced any of those, not even close). Simpler menus eliminate all these problems + cluttered menus with 999 submenus are definately not user friendly. This is probably a place where developer or site admin needs to sit down for a sec and think about the whole navigation thoroughly. – N00b Feb 23 '16 at 9:27
  • Really? Then please do tell me how I can (in a simple way) get child menu items from current menu and display them in left sidebar. Then create a page with sub-pages and create a new menu structure from those pages. Then you delete the page - the menu structure is still there until you remove it from the bin. When deleting parent page from bin, all its children becomes top level menu items. I'm talking about normal menu structures. When I got 500 Internal Server Error I had maybe 5-7 top level items and two of them had up to 10 child menu items. – Steven Feb 23 '16 at 10:04
  • Then I suggest you to rethink post hierarchy logic because parent and children should have a meaningful relation and there shouldn't be such situations where you delete only parent but not children (at least not as often that it becomes a problem). About 500 error.. Im 99% sure that the problem lies somewhere else because I've seen WP websites with absolutely monstrous menus. All queries, plugins and everything else just adds up and is too much for memory limit.. I suggest this plugin for debugging. You'll find your bottlenecks very easily. – N00b Feb 23 '16 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.