How To: Add A Link to the WordPress Multisite Network Admin Sites List

The other day I was working on a plugin for a client when I needed to add a link to the WordPress Multisite Network Admin Sites list. This is the list of sites in your WordPress Multisite network. The links I am referring to are the action links that appear when you hover over a site in the list as shown below.

WordPress Multisite Network Sites ListTo add a link, or modify any of the existing action links, we’re going to use the manage_sites_action_links action filter in WordPress. This filter will allow us to modify the action links before they are displayed on the screen. This means you can add, or remove, any links you want.

Let’s look at the code:

add_filter( 'manage_sites_action_links', 'my_plugin_network_list_action', null, 2 );

function my_plugin_network_list_action( $actions, $blog_id ) {

    $actions = array_merge( $actions, array(
	'custom_link' => '<a href="'. network_admin_url( 'sites.php' ).'">My Custom Link</a>'
    ));

    return $actions;

}

First we call the manage_sites_action_links filter hook which executes our custom function my_plugin_network_list_action(). Our function accepts two parameters: The $actions array which contains all action links and the $blog_id which stores the site ID of the site we are hovering in the list.

To add a link we are going to use the PHP function array_merge() to merge our link into the array of existing links. In this example I added a link named “My Custom Link” which links to the Network Admin sites list. The final step is to return the $actions variable. Simple as that!

For more awesome WordPress plugin goodies check out my new book: Professional WordPress Plugin Development

Enjoy this post? Be sure to subscribe to my RSS feed and my WordPress Tips and Tricks Newsletter! Also check out my WordPress books: Professional WordPress Third Edition & Professional WordPress Plugin Development

Comments

  1. What’s the best way to find actions/filters like these? I was actually looking for just this sort of thing a few days ago and couldn’t find anything about manage_sites_action_links either in the code or online. It’s possible (probable) that I just missed it, but is there a resource for this sort of stuff that someone could point me toward?

  2. International directory enquiries

  3. Through friends http://eamasoletaj.de.tl csm childsupermodels Great clip..super hot chick with huge tits, very into the sex. and huge cocks that shoot great loads on her hot face.

  4. Wonderfull great site http://ipefiytyi.de.tl nymphet models russian oh yeah its always nice and hot to have sex with others and share and watch each other getting hot

  5. Best Site good looking http://ojyorohupidi.de.tl inez nn model I love classy beautiful porn, much better then tasteless recordings people make these days, thanks so much for sharing your sexual life beautiful

  6. I’m about to run out of credit http://yhihasamin.de.tl bbs young girls pedo Love the double vag and all the cumshots throughout. I just wish they didn’t clean her up after each one and left her messy…

  7. Can I use your phone? http://gytafeyreu.de.tl little girl slips Don’t just open your mouth and wait to have him jack off, actively participate. Suck it, just like you did for his balls.