Updated Issue
Wicked Folders 2.18.10
Admin Menu Editor Pro 2.16.1
Wicked Folders Toggle must be in the root menu of Admin Menu Editor – otherwise, there is an err 404 when toggling Wicked Folders.
I’m posting this to both plugins’ support forums, but I suspect this is an Admin Menu Editor issue, because prior to 2.16.1, having the Wicked Toggle item in a sub-menu worked.
Normally, I wouldn’t care, but I have a standard menu system for all my sites, so users have been trained to look for the toggle in a certain place and…some of my root menus are rather long.
Any way to get this fixed? Certainly not urgent, but I think any WP plugin should work in a sub-menu…
-
This reply was modified 4 years, 4 months ago by
imincognito.
Here’s Admin Menu Editor’s response – TL;DR: it appears that WF needs to tweak your code just a bit to support sub-menu items.
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"]
Hi @imincognito,
Thanks for the details. We’ll look into using a class name per their suggestion and include a fix for this in the next release. Thanks for pointing out the issue.