Is there a function, action or filter that I can use to add a third level drop-down menu to the WordPress admin menu.

For instance, right now in the sidebar menu, there is a menu for posts and under posts there are sub-menus for editing posts, adding a new post, categories, and tags. There is something similar for Pages.

What I would like to do is to add a menu item called Content and place underneath content Posts, Pages and my Custom Content Types and underneath each of those entries the relevant sub-menus (editing, adding, etc.).

I would like to do this through a custom plugin that I create. The problem is, I can’t find any information on how to add a third-level sub-menu.

Any ideas?

Thanks.

2 s
2

No, it is not possible to create third level menu in admin panel. If you look at the definition of add_submenu_page, you need to mention the parent slug name. For eg:

add_menu_page ( 'Test Menu', 'Test Menu', 'read', 'testmainmenu', '', '' );
add_submenu_page ( 'testmainmenu', 'Test Menu', 'Child1', 'read', 'child1', '');

The first parameter of the add_submenu_page will be parent slug name. So you may think we can write child1 as parent slug name to create the third level. Eg:

add_submenu_page ( 'child1', 'Test Menu', 'Child2', 'read', 'child2', '');

But this will not work. Look at the parameters definition and source section in this link. It clearly states that, you can only use the name of ‘main menu of the plugin‘ or the file name of the WordPress plugin in parent slug name. So it is not possible to create submenus more than once in admin panel. However, you can create n number of sub menus in front end. To know more about creating menus and sub menus in front end, refer

Leave a Reply

Your email address will not be published. Required fields are marked *