Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created March 5, 2019 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodwardtw/c3e3471795799f163bd0f52fdb510349 to your computer and use it in GitHub Desktop.
Save woodwardtw/c3e3471795799f163bd0f52fdb510349 to your computer and use it in GitHub Desktop.
add_filter('map_meta_cap', 'less_super_admins', 10, 4);
function less_super_admins($caps, $cap, $user_id, $args){
$super = array(
'update_core',
'update_plugins',
'update_themes',
'upgrade_network',
'install_plugins',
'install_themes',
'delete_themes',
'delete_plugins',
'edit_plugins',
'edit_themes',
'delete_sites',
'setup_network',
'manage_network_plugins', //these are big removals of all the access to these items
'manage_network_themes',
'manage_network_options',
);
$still_super = [1];//user IDs for super admins to retain FULL RIGHTS - all other super admins are limited as defined above
if($user_id != in_array($user_id,$still_super) && in_array($cap, $super)) {
$caps[] = 'do_not_allow';
}
return $caps;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment