I am trying to create a sub-menu under a Custom Post Type I have named Portfolios.
When I change add_submenu_page()
to add_options_page()
, it correctly shows a new link under the Settings menu, but it doesn’t show under the Portfolios menu.
What am I doing wrong?
Below is my code snippet;
add_action( 'admin_menu', 'mt_add_pages' );
function mt_add_pages() {
add_submenu_page(
__( 'portfolios', 'menu-test' ),
__( 'Test Settings', 'menu-test' ),
'manage_options',
'testsettings',
'mt_settings_page'
);
function mt_settings_page() {
echo "<h2>" . __( 'Test Settings', 'menu-test' ) . "</h2>";
}
}
add_options_page()
automatically adds it underneath settings, howeveradd_submenu_page()
gives you control as to where you want it to show up.Try something like this:
To expand on @Jai example…
My Settings
Custom Post Type
Custom Category Taxonomy
Add Categories as submenu items
there is admin panel is a callback function name.
Link to Source , Author: Christina Blust