Adding a menu to the new network admin

Coming in 3.1, the Super Admin menu will be shuffled off to its own admin area, thus making the distinction really clear between global network actions and site-specific ones. I wrote about this back here.

“But Andrea,” some of you have said, “My menus for my plugin are in the wrong place, how do I fix it?” Fear not, for I have hunted down a lovely example for you.

Note in the trunk version of the domain mapping plugin (revision 316597) there is support to add that plugin’s menus to the network admin area. Settings is a good spot.

function dm_network_pages() { 
 	      add_submenu_page('settings.php', 'Domain Mapping', 'Domain Mapping', 'manage_options', 'dm_admin_page', 'dm_admin_page'); 
 		      add_submenu_page('settings.php', 'Domains', 'Domains', 'manage_options', 'dm_domains_admin', 'dm_domains_admin'); 
 		add_action( 'network_admin_menu', 'dm_network_pages' ); 

The action you’re going to use now and in the future is network_admin_menu. Add to whatever menu area you deem appropriate. What used to be submenu items in Super Admin is mostly a top-level menu item in network admin. Snazzy stuff.

About andrea

City kid turned country wife, obsessive crafter.


  1. You can simplify the code by using the add_options_page() wrapper function.

  2. Shouldn’t the capability be ‘manage_network’ in stead of ‘manage_options’?

    • A user only has access to network admin if they have the manage_network permission. So the permission requested for the menu item isn’t important in this instance.