Short answer:
When you move a top-level menu item to a submenu, that necessarily changes the HTML structure of the admin menu. Wicked Folders doesn’t recognize the new structure. This could potentially be fixed by changing one or two lines in Wicked Folders.
Longer, more technical answer:
I’ve looked at parts of Wicked Folders source code, and it appears that it uses this selector to find the “Toggle folders” menu item:
#adminmenu #toplevel_page_wicked_folders_toggle a
It then uses some simple JavaScript to show/hide the folder pane.
The second part of that selector is a unique ID. WordPress core automatically generates this ID based on the item’s slug and a few other things. WordPress uses this ID as the id attribute for a top-level menu.
However, WordPress never assigns id attributes to submenu items. As a result, the selector doesn’t work when the item is in a submenu.
One way to work around that would be to add an alternative selector that also works in submenus. For example, Wicked Folders could use a class instead of/in addition to an ID. Technically, the documented WordPress API doesn’t support adding CSS classes to admin menus, but the actual code does support it, and Admin Menu Editor will preserve menu CSS classes when moving an item.
For example:
#adminmenu .toplevel_page_wicked_folders_toggle a
Something more exotic, like using the menu slug in the selector, might also work:
#adminmenu li > a[href="wicked_folders_toggle"]
Janis,
Many thanks for the prompt and in-depth response.
Based on your explanation, I think WF needs to tweak their plugin to support sub-menu functionality.
In the meantime, I’ve moved this particular item to the root menu.
Cheers
Thanks Janis for looking into this and for the suggestions. We’ll implement a different selector so that the item works in sub menus as well.