Possible to enqueue scripts and CSS to Multisite Network dashboard?

Is it possible to enqueue scripts and css only to the Network Admin Dashboard?

To edit the network admin menu, you have this hook: network_admin_menu, so I also tried network_admin_enqueue_scripts, but this didn’t work.

Read More

Thanks!
Roc.

Related posts

Leave a Reply

1 comment

  1. You can use the global variable $current_screen. It has the property is_network, with a boolean value, that indicates if we are in /wp-admin/network/ or not.

    add_action( 'admin_print_scripts', 'network_scripts_wpse_91699' );
    
    function network_scripts_wpse_91699() 
    {
        global $current_screen;
        if( !$current_screen->is_network )
            return;
    
        wp_register_script( 'test', plugins_url( 'test.js', __FILE__) );
        wp_enqueue_script( 'test' );
    }
    

    This action hook can also be used like

    add_action( 'admin_print_scripts-site-new.php', 'callback' );`
    

    and it will only print in the screen /wp-admin/network/site-new.php, so there’s no need to check if the current screen is a network one or not.