Admin Menu

Last Updated: August 19, 2021

How to add an admin menu

add_action('admin_menu', 'Booking');
 
function test_plugin_setup_menu(){
    add_menu_page( 'Test Plugin Page', 'Test Plugin', 'manage_options', 'test-plugin', 'test_init' );
}
 
function test_init(){
    echo "<h1>Latest Bookings</h1>";
}
 

How to add a submenu

You can use add_submenu_page function to add sub menu page to your parent menu

add_submenu_page( string $parent_slug, string $page_title, string $menu_title, string $capability,
 string $menu_slug, callable $function = '', int $position = null )