Hide Import and Export From Site Admins
Removes Tools > Import and Tools > Export from subsite dashboards for non-super-admins and blocks the screens, keeping content moves in the network team's hands.
Opens WPIDE on
Code
if ( ! is_multisite() ) {
return;
}
add_action( 'admin_menu', function () {
if ( ! is_super_admin() ) {
remove_submenu_page( 'tools.php', 'import.php' );
remove_submenu_page( 'tools.php', 'export.php' );
}
}, 999 );
$wpide_block = function () {
if ( ! is_super_admin() ) {
wp_die( esc_html__( 'Importing and exporting is handled by the network administrator.' ), 403 );
}
};
add_action( 'load-import.php', $wpide_block );
add_action( 'load-export.php', $wpide_block );
Notes
""
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.