#5311
whitenoise
Participant

Also I wanted to remove some (but not all) of the roles from the ‘Role’ box on the new user screen. I came across this code:

// Remove Administrator role from roles list
add_action( 'editable_roles' , 'hide_adminstrator_editable_roles' );
function hide_adminstrator_editable_roles( $roles ){
    if ( isset( $roles['administrator'] ) && !current_user_can('level_10') ){
        unset( $roles['administrator'] );
        // add more unset rules here for your user roles
    }
    return $roles;
}

Which does the job perfectly if it helps anyone else.