只需编辑这部分代码即可:
function editable_roles( $roles ){
if( isset( $roles[\'administrator\'] ) && !current_user_can(\'administrator\') ){
unset( $roles[\'administrator\']);
}
return $roles;
}
并将其更改为
function editable_roles( $roles ){
//don\'t change anything if current user is admin
if (current_user_can(\'administrator\')) {
return;
}else{
if( isset( $roles[\'administrator\'] ) && !current_user_can(\'administrator\') ){
unset( $roles[\'administrator\']);
//here you add "unset( $roles[\'role_to_remove\']);" for each role you wish to remove
}
return $roles;
}