Hide the Plugins Screen From Site Admins
Removes the Plugins menu from subsite dashboards for everyone except super admins and blocks direct visits, even if "Enable administration menus" is on in Network Settings.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_action( 'admin_menu', function () {
if ( ! is_super_admin() ) {
remove_menu_page( 'plugins.php' );
}
}, 999 );
add_action( 'load-plugins.php', function () {
if ( ! is_super_admin() ) {
wp_die( esc_html__( 'Sorry, you are not allowed to manage plugins on this network.' ), 403 );
}
} );
Notes
Network-activated plugins keep running; only the screen is hidden.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.