Unexpected outcome when all menu items unchecked
-
This plugin mostly works great, and does exactly what I need. I have, though, one page on which I want NO menu items at all to be shown. When I unchecked all the items, instead of getting no menu items I get *all* the menu items.
Checking the code, this appears to be a deliberate choice. In the “psmi_add_menu_class” function, the code checks !empty($currentpage_items). If $currentpage_items is empty it then skips the remaining code in the function — and leaves the menu showing every possible menu item.
This doesn’t seem like the right outcome to me. I would expect all the menu items to be hidden. If there is some problem or ambiguity in this case, I would expect all the menu items to either show or hide depending on the ‘default’ option chosen in the settings.
A fix would seem obvious — the if test that checks !empty($currentpage_items) could simply be removed. However, I don’t know what the other consequences of that would be. Presumably this test was added for some reason. Over to you.
NB I have a workaround for my own needs: I’ve added a hook that hides the entire menu on that particular page. However, this was exactly the kind of code I was hoping to avoid by using this plugin :-/ Still, it means I’m not waiting urgently for a fix. Just raising this to help improve what is already a very useful plugin.
- The topic ‘Unexpected outcome when all menu items unchecked’ is closed to new replies.