• When a submenu item is hidden (cosmetic), the main menu item loses its url and is instead redirected to the url of the current submenu top item.

    For example, when All Posts submenu item is hidden, the main Posts should go to edit.php, but it goes to post-new.php instead, which is the url for the current top (non-hidden) submenu item.

    It does this no matter which submenu item ends up at the top.
    For example, when All Posts, Add New and Categories are all hidden, the main Posts link is redirected to edit-tags.php?taxonomy=post_tag

    When ALL submenu items are hidden, the main menu item goes to its own (the correct) url.

    This behavior is with any menu item, not just Posts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    As far as I can tell, that sounds like standard WordPress behavior. When a top-level menu has any visible and accessible submenu items, the top-level menu will go to the URL of the first submenu item. This is not related to Admin Menu Editor. It works like that even if you don’t have any active plugins.

    If you want to override that behavior, you may be able to do it by hiding the first submenu item with CSS/JS. However, it’s not possible to do that with this particular plugin.

    Thread Starter IT Hertz

    (@it-hertz)

    You’re right. I see that’s the case with all menu items, including all the plugins I have installed. I suppose this is WP standards/convention that plugin authors must adhere to.
    Having a differently named submenu item that performs the same function as its parent is redundant, poor aesthetics and adds clutter. I see no good reason for its existence.

    My use case: I want to hide the All Users sub item for my subadmins, purely for aesthetic reasons. It looks odd to have that extraneous/superfluous submenu item there when clicking on it does nothing more than the parent menu item does. And, the parent menu item has a nice icon beside it which the child item doesn’t. bleh…

    I tried hiding All Users via Adminimize, but no joy, so I tried your plugin.

    I suppose I can hide it via CSS per user role, but I prefer to avoid hiding things via CSS where possible. I will see if there’s a WP hook that I can use a filter on, perhaps to unset the item as the menu populates.

    Plugin Author Janis Elsts

    (@whiteshadow)

    In general, you can use a hook (e.g. admin_menu) and unset a menu item, but in this case, it’s likely that you would still get the same result. If I’m reading the relevant part of the WP source code correctly, menu URL selection happens immediately before WP outputs the menu. There don’t seem to be any hooks you could use to modify the menu after WordPress has chosen the URL but before it outputs the submenu items.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘hidden submenu item bug’ is closed to new replies.