Adding sub menus is easy with add_submenu_page
and is working fine as long if you define a $parent_slug
:
add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function );
if you set the $parent_slug
to NULL
as described here to hide it from any menu item the title of the page will get ignored ($page_title
)
add_submenu_page( NULL, $page_title, $menu_title, $capability, $menu_slug, $function );
I’ve tested it with all versions from 3.3 up to the latest 4.0
1 Answer
It is a valid question and an issue I have encountered as well.
I did not go through the WP core code to see why the title is missing, but I can offer a solution using the admin_title filter, for people facing a similar problem:
function fix_your_page_title( $admin_title, $title ) {
if ( get_current_screen()->id === 'your_page_id' && $title === '' ) {
$admin_title="Your page title" . $admin_title;
}
return $admin_title;
}
add_filter( 'admin_title', 'fix_your_page_title', 10, 2 );