我正在尝试创建一个顶部菜单和一个子菜单,但为了防止在子菜单中重复顶部菜单,我将子菜单设置menu_slug
为与顶部菜单中的相同。为什么在这种情况下根本不显示子菜单?
add_action("admin_menu", "setup_theme_admin_menus");
function setup_theme_admin_menus() {
add_menu_page('Theme settings', 'Example theme', 'manage_options',
'tut_theme_settings', 'theme_settings_page');
add_submenu_page('tut_theme_settings',
'Front Page Elements', 'Front Page', 'manage_options',
'tut_theme_settings', 'theme_front_page_settings');
}
// Handler to top level menu
function theme_settings_page() {
}
function theme_front_page_settings() {
echo "Some text of submenu page";
}