Title: Wicked Folders &#8211; Toggle Function &#8211; err 404
Last modified: January 31, 2022

---

# Wicked Folders – Toggle Function – err 404

 *  Resolved [imincognito](https://wordpress.org/support/users/imincognito/)
 * (@imincognito)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/wicked-folders-toggle-function-err-404/)
 * 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…

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Janis Elsts](https://wordpress.org/support/users/whiteshadow/)
 * (@whiteshadow)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/wicked-folders-toggle-function-err-404/#post-15310918)
 * _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"]`
 *  Thread Starter [imincognito](https://wordpress.org/support/users/imincognito/)
 * (@imincognito)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/wicked-folders-toggle-function-err-404/#post-15311490)
 * 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
 *  [wickedplugins](https://wordpress.org/support/users/wickedplugins/)
 * (@wickedplugins)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/wicked-folders-toggle-function-err-404/#post-15311822)
 * 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.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Wicked Folders – Toggle Function – err 404’ is closed to new replies.

 * ![](https://ps.w.org/admin-menu-editor/assets/icon-128x128.png?rev=1418604)
 * [Admin Menu Editor](https://wordpress.org/plugins/admin-menu-editor/)
 * [Support Threads](https://wordpress.org/support/plugin/admin-menu-editor/)
 * [Active Topics](https://wordpress.org/support/plugin/admin-menu-editor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/admin-menu-editor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/admin-menu-editor/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [wickedplugins](https://wordpress.org/support/users/wickedplugins/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/wicked-folders-toggle-function-err-404/#post-15311822)
 * Status: resolved