对于进入管理菜单的自定义链接,您需要通过其slug选择顶级菜单项,并使用admin_menu 行动挂钩。
下面是主管理菜单段塞的列表。
index.php => Dashboard
edit.php => Posts
upload.php => Media
link-manager.php => Links
edit.php?post_type=page => Pages
edit-comments.php => Comments
themes.php => Appearance
plugins.php => Plugins
users.php => Users
tools.php => Tools
options-general.php => Settings
所有管理菜单和子菜单名称、键和slug的列表。
Image Source
如果要使用外部链接,则代码为:
add_action(\'admin_menu\', \'add_custom_link_into_appearnace_menu\');
function add_custom_link_into_appearnace_menu() {
global $submenu;
$permalink = \'http://www.cusomtlink.com\';
$submenu[\'themes.php\'][] = array( \'Custom Link\', \'manage_options\', $permalink );
}
如果要使用呈现自定义链接页
WordPress Administrations Menus 功能则代码为:
add_action(\'admin_menu\', \'add_custom_link_into_appearnace_menu\');
function add_custom_link_into_appearnace_menu() {
add_theme_page(\'Custom Link Pgae Title\', \'Custom Link Menu Title\', \'manage_options\', \'custom-link-unique-identifier\', \'render_custom_link_page\');
}
function render_custom_link_page() {
echo \'Custom Link Page\';
}