I have added the code below to a plugin:
add_action( 'admin_init', 'remove_add_users_cap' );
function remove_add_users_cap() {
$role = get_role( 'administrator' );
$role->remove_cap( 'add_users' );
$role->remove_cap( 'create_users' );
}
And I can see that the caps are no longer on my user:
if(!function_exists('wp_get_current_user')) {
include(ABSPATH . "wp-includes/pluggable.php");
}
$current_user = wp_get_current_user();
echo '<pre>';
print_r($current_user);
echo '</pre>';
But I can still add new users O.o ...
Is there something else that needs to be done to achieve this? I would like to completely remove the ability for anyone to add a new user when this plugin is activated...
This is in a Wordpress Multisite context, and I have a feeling that may be complicating things.
Thanks,