Using WordPress ‘manage_sites_action_links’ PHP filter

The manage_sites_action_links WordPress PHP Filter allows you to modify the action links displayed for each site in the Sites list table.

Usage

add_filter( 'manage_sites_action_links', 'your_custom_function', 10, 3 );

function your_custom_function( $actions, $blog_id, $blogname ) {
    // your custom code here
    return $actions;
}

Parameters

  • $actions (string[]): An array of action links to be displayed.
  • $blog_id (int): The site ID.
  • $blogname (string): Site path, formatted depending on whether it is a sub-domain or subdirectory multisite installation.

More information

See WordPress Developer Resources: manage_sites_action_links

Examples

Add a “Settings” link to the action links for each site.

add_filter( 'manage_sites_action_links', 'add_settings_link', 10, 3 );

function add_settings_link( $actions, $blog_id, $blogname ) {
    $actions['settings'] = '<a href="' . esc_url( admin_url( 'settings.php' ) ) . '">Settings</a>';
    return $actions;
}

Remove the ‘Visit’ link from the action links for each site.

add_filter( 'manage_sites_action_links', 'remove_visit_link', 10, 3 );

function remove_visit_link( $actions, $blog_id, $blogname ) {
    unset( $actions['visit'] );
    return $actions;
}

Change the text of the ‘Dashboard’ link to ‘Admin’.

add_filter( 'manage_sites_action_links', 'change_dashboard_text', 10, 3 );

function change_dashboard_text( $actions, $blog_id, $blogname ) {
    $actions['backend'] = str_replace( 'Dashboard', 'Admin', $actions['backend'] );
    return $actions;
}

Rearrange the action links to display the ‘Visit’ link first.

add_filter( 'manage_sites_action_links', 'rearrange_action_links', 10, 3 );

function rearrange_action_links( $actions, $blog_id, $blogname ) {
    $visit_link = $actions['visit'];
    unset( $actions['visit'] );
    array_unshift( $actions, $visit_link );
    return $actions;
}

Add a “Special” link for a specific site ID (e.g., 3).

add_filter( 'manage_sites_action_links', 'add_special_link', 10, 3 );

function add_special_link( $actions, $blog_id, $blogname ) {
    if ( $blog_id == 3 ) {
        $actions['special'] = '<a href="' . esc_url( admin_url( 'special-page.php' ) ) . '">Special</a>';
    }
    return $actions;
}