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
- Show function to super admin
- Generate pages from markdown files in github automatically
- There is any way to remove post-format filter? [closed]
- Install (enable) plugins on multisite, on localhost
- WordPress multi domain – redirect
- Subsite access without being a member of the subsite in wp multisite network
- WordPress wp-admin/network/plugin-install
- How to create restrict content to users (by user, not by role)
- Create a multisite network for an existing installation
- “Micro-Site” Options
- External Domain on WordPress Multisite
- Enable users to change change and add taxonomies of posts
- 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?
- Configuring Propel to Work with Multisite
- Setup page on first login on multisite
- Custom User meta field display
- Subdomains with almost the same content
- Uninstalling plugins across all sites
- Multiple domains issue
- Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?
- Unable to delete custom post types, confusion around capabilities
- Users are being redirected to main site when trying to register on subsite of my Multisite network
- “Master” WordPress Multisite – Database Sync
- Will these plugins work with wp multisite?
- User Signup in Multisite – Need Plugin or Advice
- Add custom text color WordPress 3.9 TinyMCE 4 Visual editor
- Redirect to another page using contact form 7? [closed]
- edit_user_profile and show_user_profile are not firing inside a class
- Network activating; if ( !current_user_can( ‘manage_options’ ) ) locks me out…
- Certain functions are undefined when called form mu-plugins
- Multisite for Multisite?
- How to create multiple users at once?
- Shortcode to update user meta
- Is there a way to get plugins and themes not built for multisite to work on a network subsite?
- How do I get the user ID of the user that was updated in WordPress?
- Create a single website with 3 theme options in wordpress
- Why shortcode always displayed after footer not in body
- How to have sample page for each new register users in a membership website
- WordPress Multisite: Programmatically Activate / Deactivate a Plugin of a Specific Blog
- How to get all posts belongs to a user between a certain date
- One sub site is slow while all others load fine, same theme & plugins [closed]
- Specific way to allow WordPress users to view their current password? And edit it?
- how can I query all wordpress users of a blog
- Add Content to Content()
- How to display terms and conditions in post area?
- How to see which sites use my installed plugins (wordpress multisite)
- 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?
- get_users(); Is an Undefined Function When Used in Cron Job
- WordPress super admin login issue. (Automatically logout)
- How do I get the Payzone WooCommerce payment gateway plugin to show up in the settings? [closed]
- Managing wordpress Themes & plugins for multisite
- How limit user connection?
- How to remove a CPT Menu from the Root Admin only
- Custom Login page with custom redirects for each user?
- Hosting multiple sites
- how to make dynamic subdomain for each user registering?
- How to pass a query string to another page on the same site?
- Redirect Plugins.php to New Plugin Page
- WordPress /users/me endpoint request forbidden
- Mutliple users editing single document in wordspress
- same user role or copy the user role to be same as the other role
- Issue removing Media Editor Tabs — Duplicate Items
- WordPress’s is_plugin_active_for_network function not working for multisites
- Cannot add edit themes and add plugins after multisite update
- Each User has a Personal Blog
- Plugin permissions for Editor role
- Personalized Author Area
- Storing Form data in a different database
- 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
- Do WordPress plugins suport multisite site?
- WordPress plugin for Limited days user
- How to hide plugin options for editors via functions.php
- Multisite Plugin – Access options (wp_options) on child sites
- looking for a multi-user hello-world plugin
- How to get values from network settings panel?
- Plugin privelages for “editors”
- Share plugins, themes, and multi post in a multidomain network
- Plugin to create unlimited custom shortcodes?
- Constructing a Pay to Download music website with wordpress
- After enable multisite enviroment in wordpress site creation wizard not working
- Shortcode not displaying HTML within the function
- Janrain/Simple Modal under Redirected Domain
- Bulk User Deletion
- Can’t save changes or modify settings in Dashboard but Pages and Posts are fine