Display multiple CPTs as submenus in a custom WP admin menu
-
I’d like to add a few CPTs to a single group menu in WP Admin, like we see in Apperance, Tools and Settings in WP Admin.
With the help of WP documents for add_menu (add_menu_page() – Function | Developer.www.ads-software.com), I was able to create an admin menu. Below is the code snippet I used.
add_action( 'admin_menu', 'example_mega_menu' );
function example_mega_menu() {
add_menu_page( 'exampleMenu', 'exampleMenu', 'manage_options', 'examplemenu', '', 'dashicons-welcome-widgets-menus', 4 );
};After that, for CPTs (say CPT1 and CPT2), I toggled on ‘Show in Admin Menu’ and typed in ‘examplemenu’ in “Admin Menu Parent” field.
It didn’t work, so I tried with “edit.php?post_type=’examplemenu'”, but it still does not work.
Can’t find where I did wrong. What’s the value that I am supposed to fill in to ‘Admin Menu Parent’? Did I do anything wrong in creating admin menu? I was going to do the same for CPT specific categories, but I cannot see any option in Taxonomies. Ideally, For each CPT, the categories should be listed in the mega menu group.
- You must be logged in to reply to this topic.