How to add a tab to the WordPress Admin menu

Here is a short code snippet for creating your own tab in the admin menu. You can put that code in the theme functions.php, a custom plugin code or in a code snippet tool.

//Add a new tab to the menu
add_action('admin_menu', 'my_admin_menu_tab');

//Defined the tab name, function call and icon
function my_admin_menu_tab(){
    add_menu_page('TabName', 'TabName', 'manage_options', 'TabName', 'my_admin_menu_tab_call', 'dashicons-admin-site');
}

//The content of your tab
function my_admin_menu_tab_call(){
    echo "<h3>Welcome to my Admin Tab</h3>";
}

And here is the final result: