我试图理解在管理面板中创建自定义插件页面和菜单,但我得到了我不需要的东西。我有:
function my_plugin_add_pages() {
add_menu_page(__(\'Custom quiz\', \'custom-quiz\'), __(\'Custom quiz\', \'custom-quiz\'), 5, \'custom-quiz-listing-page\', \'custom_quiz_list_page\');
add_submenu_page(\'custom-quiz-listing-page\', __(\'Add quiz\'), __(\'Add quiz\'), 6, \'custom_quiz_add_quiz\', \'custom_quiz_add_quiz\');
add_submenu_page(\'custom-quiz-listing-page\', __(\'Edit quiz\'), __(\'Edit quiz\'), 6, \'custom_quiz_edit_quiz\', \'custom_quiz_edit_quiz\');
}
function custom_quiz_list_page() {
require_once(\'includes/quiz-listing.php\');
}
function custom_quiz_add_quiz() {
if (!empty($_POST)) {
CreateQuiz($_POST);
echo \'<meta http-equiv="refresh" content="0;url=?page=custom-quiz-listing-page" />\';
}
require_once(\'includes/add-quiz.php\');
}
function custom_quiz_edit_quiz() {
if (!empty($_GET[\'quiz_id\']) && !empty($_POST))
UpdateQuiz($_POST);
require_once(\'includes/edit-quiz.php\');
}
问题是,所有这些页面(甚至子页面)都是在管理面板的菜单侧栏中创建的。如何在不将页面粘贴到管理菜单的情况下正确创建页面?