admin管理员组文章数量:1201975
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
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
Share Improve this question edited Sep 10, 2014 at 12:59 Xaver asked Sep 10, 2014 at 11:15 XaverXaver 1,0393 gold badges13 silver badges29 bronze badges 5 |1 Answer
Reset to default 0It 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 );
本文标签: Why is the Page Title missing on Pages added with addsubmenupage
版权声明:本文标题:Why is the Page Title missing on Pages added with add_submenu_page? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738597418a2101864.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<title>
tag be set regardless of whether the page has a parent or not. Perhaps this is a bug report for WP? – Ben Commented Feb 26, 2021 at 11:43