在这里我创建页面:
add_action("admin_menu", "wpa_create_plugin_pages");
function wpa_create_plugin_pages() {
//Add submenu to Users
$wpa_profile = "wpa_user_profile_settings";//parent slug
$wpa_user_meta = get_user_meta(get_current_user_id());//don't mind this
$wpa_role = $wpa_user_meta["wpa_toto_role"][0];//don't mind this
//add_menu_page("אזור אישי", "אזור אישי", "read", $wpa_profile, "wpa_user_de", 'dashicons-admin-users');
add_menu_page("משתמשים", "משתמשים", "read", $wpa_profile, "wpa_user_de", 'dashicons-admin-users');// the parent
add_submenu_page($wpa_profile, "ערוך פרופיל אישי", "ערוך פרופיל אישי", "read", "wpa_edit_my_profile", "wpa_edit_my_profile");//children
add_submenu_page($wpa_profile, "רשימת משתמשים", "רשימת משתמשים", "read", "wpa_user_list", "wpa_users_list");//children
add_submenu_page($wpa_profile, "צור משתמש", "צור משתמש", "read", "wpa_user_profile", "wpa_user_profile");//children
add_submenu_page($wpa_profile, "שלח נקודות", "שלח נקודות", "read", "wpa_user_send_points", "wpa_user_send_points");//children
add_submenu_page($wpa_profile, "הוסף נקודות", "הוסף נקודות", "read", "wpa_create_points", "wpa_admin_create_points");//children
}
我与get_current_screen()一起使用来输出此数据。
如您所见,WP_Screen对象内部的基址和ID为%d7%9e%d7%a9%d7%aa%d7%9e%d7%a9%d7%99%d7%9d_page_wpa_user_list ...
%d7%9e%d7%a9%d7%aa%d7%9e%d7%a9%d7%99%d7%9d =משתמשים(希伯来语用户),它的网址编码了父页面的标题。
甚至body类也具有-d7-9e-d7-a9-d7-aa-d7-9e-d7-a9-d7-99-d7-9d_page_wpa_user_list。
我可以在子菜单页面上添加自定义前缀吗?