Completely remove ability to create users?

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( ‘add_users’, ‘create_users’, ); if( in_array($cap, $super) ) { $caps[] = ‘do_not_allow’; } return $caps; }

Assigning multiple or additional capabilities to specific users or how to create additional roles like bbpress roles?

In WordPress is pretty simple create custom roles and also assign specific capabilities to specific user roles (no matter if from core or custom). In my plugins I often create an user role that has all the capabilities required by my plugin, and then I attach some of thos capabilities to existing roles. I’ll give … Read more