Hide admin menus for non Network Admins
<?php
/*
* Hide admin menus for non Network Admins
*/
function custom_remove_admin_theme_remove_menus () {
if( !current_user_can( 'manage_network' ) ) {
global $menu;
$restricted = array(
__( 'Posts' ),
__( 'Media' ),
__( 'Links' ),
__( 'Pages' ),
__( 'Tools' ),
__( 'Users' ),
__( 'Settings' ),
__( 'Comments' ),
__( 'Plugins' ),
__( 'QRcode'),
);
end ( $menu );
while ( prev( $menu ) ) {
$value = explode( ' ',$menu[key( $menu )][0] );
if ( in_array( $value[0] != NULL ? $value[0]: '', $restricted ) ) {
unset( $menu[key( $menu )] );
}
}
remove_menu_page( 'edit-comments.php' );
remove_menu_page( 'themes.php' );
remove_menu_page( 'plugins.php' );
remove_menu_page( 'admin.php?page=mp_st' );
remove_menu_page( 'admin.php?page=cp_main' );
remove_submenu_page( 'edit.php?post_type=product', 'edit-tags.php?taxonomy=product_category&post_type=product' );
remove_submenu_page( 'edit.php?post_type=product', 'edit-tags.php?taxonomy=brand&post_type=product' );
remove_submenu_page( 'edit.php?post_type=product', 'edit-tags.php?taxonomy=model&post_type=product' );
remove_submenu_page( 'edit.php?post_type=product', 'edit-tags.php?taxonomy=product_tag&post_type=product' );
}
}
add_action('admin_menu', 'custom_remove_admin_theme_remove_menus', 10);