The network_admin_menu WordPress PHP action fires before the administration menu loads in the Network Admin.
Usage
add_action('network_admin_menu', 'your_custom_function');
function your_custom_function() {
// your custom code here
}
Parameters
$context(string) – Empty context.
More information
See WordPress Developer Resources: network_admin_menu
Examples
Adding a custom menu item
Add a custom menu item in the Network Admin menu.
add_action('network_admin_menu', 'add_custom_network_menu_item');
function add_custom_network_menu_item() {
add_menu_page('Custom Menu', 'Custom Menu', 'manage_network', 'custom-menu', 'display_custom_menu_page');
}
function display_custom_menu_page() {
echo 'This is the Custom Menu page.';
}
Removing a menu item
Remove a specific menu item from the Network Admin menu.
add_action('network_admin_menu', 'remove_specific_network_menu_item', 999);
function remove_specific_network_menu_item() {
remove_menu_page('themes.php');
}
Reordering menu items
Reorder the Network Admin menu items.
add_action('network_admin_menu', 'reorder_network_menu_items', 999);
function reorder_network_menu_items() {
global $menu;
// Change the position of the 'themes.php' menu item
$menu[15] = $menu[20];
$menu[20] = '';
}
Adding a submenu item
Add a custom submenu item to an existing Network Admin menu.
add_action('network_admin_menu', 'add_custom_network_submenu_item');
function add_custom_network_submenu_item() {
add_submenu_page('sites.php', 'Custom Submenu', 'Custom Submenu', 'manage_network', 'custom-submenu', 'display_custom_submenu_page');
}
function display_custom_submenu_page() {
echo 'This is the Custom Submenu page.';
}
Changing menu item labels
Change the labels of existing Network Admin menu items.
add_action('network_admin_menu', 'change_network_menu_item_labels', 999);
function change_network_menu_item_labels() {
global $menu;
// Change the label of 'Dashboard' menu item
$menu[2][0] = 'My Dashboard';
}