Setup Top Level Admin Menu
-
I’m trying to create custom admin menu, seeing the example here https://codex.www.ads-software.com/Adding_Administration_Menus but it seems not working. When I click on ‘Test Toplevel’ it goes to https://mydomain/mydir/wp-admin/testtoplevel, is this example correct? do I need to put relative path to my plugin directory?
Here I paste the example on that page:
// Hook for adding admin menus add_action('admin_menu', 'mt_add_pages'); // action function for above hook function mt_add_pages() { // Add a new top-level menu (ill-advised): add_menu_page('Test Toplevel', 'Test Toplevel', 8, 'testtoplevel', 'mt_toplevel_page'); // Add a submenu to the custom top-level menu: add_submenu_page(__FILE__, 'Test Sublevel', 'Test Sublevel', 8, 'sub-page', 'mt_sublevel_page'); // Add a second submenu to the custom top-level menu: add_submenu_page(__FILE__, 'Test Sublevel 2', 'Test Sublevel 2', 8, 'sub-page2', 'mt_sublevel_page2'); }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Setup Top Level Admin Menu’ is closed to new replies.