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;
}
Related Posts:
- Multisite functions to communicate with individual site functions
- Reset WordPress website
- How can I copy all users to newly created site on a multisite network in WordPress?
- Multisite – maximum number of users with specific role
- Understanding State in WordPress Multisites
- Remove specific administrator’s capability
- Creating teams of users in WordPress
- How to implement data residency in my WordPress site
- Want to add post to user dashboard
- ‘Global’ settings page for multisite plugin
- Override WordPress user with Oauth2 account
- Auto Load Plugin Hooks inside Must Use Plugin
- Where the Nickname is being used in WordPress
- Loading posts associated only to the logged in user on recent posts page
- How can i force Display names to be the same as Usernames?
- WordPress Capabilities: edit_user vs edit_users
- Can I enable/disable/hide plugins on a per-site basis in multisite?
- How to enable Admins to see Plugins
- How to assign user a role if none is present when logging in
- How can a plugin run a script after being updated in MultiSite?
- Network-Wide Plugin Settings Management
- How to create custom LOGIN and REGISTRATION forms?
- How can I let users to access plugin functions based on roles?
- Get User ID from within a plugin
- Is it possible to block subscriber users to changing its password?
- Is there a way to share content amongst wordpress sites
- delete_user_meta Delete one value out of array
- WordPress Plugin for One-Time Event Registration? [closed]
- Will WordPress username displayed somewhere in the site?
- Upload files programmatically to users
- Get list of sites that uses specific plugin or theme
- WordPress language switcher
- Mass Import Users without sending new user notification
- get_option compatible with wordpress network (multisite)?
- Current user in plugin returns NULL
- Cannot access wp-admin after disabling all plugin
- How to hide plugin from WordPress Multisite admin plugin list
- Is the wordpress user-model changed in wpmu?
- Error 404 using wpml plugin
- Two people sharing user in WordPress [closed]
- Update User Role
- How to define WordPress plugin shortcode globally for multisite?
- Unable to install theme recommended plugins on Multisite
- Disable multisite-wide plugins on specific sites
- WordPress Multisite plugin delegation
- How do I tell what plugins are used on my multisite install?
- How to get current post user id
- Solutions to repost categories into multisite blogs?
- Any recommendation on how to manage ads?
- Plugins not showing in Multisite dashboard
- How can I force users to a particular subdomain to log in for MU (Multisite)?
- Does any one have Idea to get these functionalities with the plugin wp-multi-network
- WordPress multi domain – redirect
- How to create restrict content to users (by user, not by role)
- How can I change the meta_key for a particular piece of information?
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- Subdomains with almost the same content
- Uninstalling plugins across all sites
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- How to have sample page for each new register users in a membership website
- One sub site is slow while all others load fine, same theme & plugins [closed]
- How to check wp_options’s rewrite_rules if current and existing are the same before flush the rules?
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- Add User Role: Pre-saved in User-Meta [SOLVED]
- How to integrate together a website currently hosted WordPress.com and a custom web application currently hosted on Azure?
- How limit user connection?
- How to remove a CPT Menu from the Root Admin only
- How to pass a query string to another page on the same site?
- WordPress /users/me endpoint request forbidden
- Cannot add edit themes and add plugins after multisite update
- How to auto strip hyperlinks & images in wordpress post
- How To Create A File Archive in WordPress?
- Role based permission edit for plugins
- how to make a wplang for network fill automatically
- Plugin privelages for “editors”
- Plugin to create unlimited custom shortcodes?
- Shortcode not displaying HTML within the function
- Janrain/Simple Modal under Redirected Domain
- In a WPMU that uses several different domains, how to enable users to register subdomains of any domain from the main site?
- WP Forms not displaying,becomming an fatal error
- Can we hide a certain user in WP?
- disable plugin activation on no multisite
- After reading 3 story by user ask for subscription popup
- Multisite converted to Single Site can’t add new plugins or new themes
- How do I run my custom function in my plugin when a wordpress user is deleted?
- Category as Subdomain for One WP Install
- Custom User Notice Upon Login
- How to Call Function From Separate WordPress Install on Same Server?
- Coming soon pages with rest of site in maintenance mode
- Query Shortcode from a multisite to appear on a different site?
- How to enable Admins to see Plugins
- How to order users alphabetically by name? in plugin UPME
- Multiple Accounts on 1 email – Multisite
- How change menu for each user in plugin?
- Check if user is in a group of another site within multisite network [closed]
- WordPress multisite haml templates
- Convert usernames listed by the Groups plugin shortcode to displayed names?
- Displaying custom profile fields using Mingle Plugin
- WordPress User Portal
- Share or sync user table data with another user table