WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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>';
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.


share|improve this question
Incidentally, from the codex: "This setting is saved to the database (in table wp_options, field wp_user_roles), so it might be better to run this only once, probably on theme/plugin activation or deactivation" – vancoder Apr 2 '13 at 22:07

Okay, so the code above does work, but not for super admins, you must explicitly remove permissions from super admins, like this:

// restrict super admin capabilites
add_filter('map_meta_cap', 'restrict_super_admins', 10, 4);
function restrict_super_admins($caps, $cap, $user_id, $args){
    $super = array(
    if( in_array($cap, $super) ) {
        $caps[] = 'do_not_allow';
    return $caps;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.