List all the admins of each site
Side note: Dividing these up by site would also be handy.
Let’s do that here:
We can list the url of each site with:
wp site list --field=url
We can list all administrators of a given site with:
wp user list --role=administrator --url=https://example.tld/site1
These commands can be combined with e.g. xargs
as suggested on the wp-cli site:
wp site list --field=url \
| xargs -I % wp user list --role=administrator --url=%
We might also want to use | tail --lines=+2
to skip the url header, of the first command as explained in the tail manual and answers like this one.
Thanks to @grappler for suggesting --field="url"
instead of --fields="url"
with | tail --lines=+2
to skip the header row.
If we want to display the url before each table:
for url in $( wp site list --field="url" ); \
do \
echo $url; \
wp user list --role=administrator --url=$url; \
done;
Related Posts:
- Assign role to user on first login, if they are first (after admin)
- How to change user starting role in WordPress MultiSite?
- WordPress multisite, allow non super admins to create sites
- Easily adding multiple existing users to a multisite site
- How to give “author” user role appropriate capabilities to add PollDaddy polls? WordPress multisite
- Where are available Roles Defined in the wp_ database?
- Why are my roles not visible in a Multi-site/Network?
- Site admin in a network install can’t edit users?
- How do I remove/delete an old super admin user?
- Troubleshooting a “You do not have sufficient permissions to access this page” error
- Issue with Custom Roles in Multisite
- How to enable a site administrator to edit users in a WordPress network/ multisite setup?
- How to reset passwords for all users on a network using wp cli
- WP-CLI methods for get_current_blog_id, get_blog_details or $wpdb->prefix
- Delete sites in wordpress multisite (not suspend)
- How can I display all Multisite blogs where this user is administrator?
- How to synchronize user profile fields in multisite?
- wp-cli is not working properly. No response from commands
- Add role across network in multisite
- Restrict users on multisite WordPress install
- Generate WP-CLI @alias for each site on multisite
- Possible to make custom role in multisite that can add sites?
- Prevent user creating new users with specific roles
- Get first_name and last_name on user_register hook
- User registration on subsite in multisite configuration
- Lock one of WP Network sites for not registered users
- Using WP CLI to set options in WP Multisite
- Can you have multi-site WP and keep users separate?
- WordPress Multisite Layered Admins
- Multisite Independent User Base
- How To Remove Dashboard Menu Items for Multisite Users?
- How to get a user role of a specific blog in multisite?
- Can simple Admin save options in a Multisite?
- How do I use different domain for subdomains in WP Multisite?
- Deleting a user in multisite
- How to run nested xargs commands?
- how do I configure nginx for wordpress multisite, it occurs ERR_TOO_MANY_REDIRECTS
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- create_users capabilities on a role on multisite
- How do I list multisite users for the current site only
- Within the database, where is the flag which says that a user has Super Admin rights?
- Update User Role Across Network when Main Site User is Updated
- Avoid having infinite loops
- Get the User ID Who Owns a Given Blog ID in Multisite
- Create custom role, multisite, add users/sites?
- Removing a wordpress multisite installation and preserving the database before migrate to nginx
- access the plugins for each role in WordPress multisite
- How to create a network using a command line script?
- What is meant by Multisite in WordPress?
- Allow Author on Site A capability to upload files on Site B in Multi Site
- Add menu items/actions for multisite users who are registered on the network but do not have a role or capability in any sites
- Multisite User Sync Question about blog authorship
- Preferred method of setting user role only works on Main Site in Network
- Register existing user on another site in a multisite network?
- WP-CLI cron on multisite using WP-Toolkit “succeded”, but callback not executed
- Subsite access without being a member of the subsite in wp multisite network
- Error: reassigning content to a different user is not supported on multisite
- Multisite user roles – capabilities not working
- single sign on for wordpress multi site
- Create Custom Multisite User Role to Reduce Capabilities
- Restrict Capability of Administrator to Create, Edit and Delete Pages in Multisite
- Multi-Site Subfolder User Permission Issue
- Migrating Multisite with WP-Cli and/or Search-Replace-DB
- I want to create a 300 multi-site wordpress network using subdomains
- Create WordPress Multisite Instance Programmatically
- Network of multisites in WordPress, create new site with all the contents of the main
- Remove superadmin role from the “change role to” menu in user listing
- Cannot select signup_meta upon multisite user activation
- How to change a user role after registering in multisite?
- How to sync roles across Multisite?
- Multisite network admin – User’s role not showing up
- WordPress Multisite Add User
- User registration is currently not allowed
- Give users acces to admin a single post or set up WP network?
- can’t create user without email for an author after converting single site to multisite
- WP-Cli Error When Mapping Multisite Subdomain
- How to clone homepage for multi region site?
- Automatically add a registered user on the wordpress multisite network even to just one other site
- wp option get blogname –url=my-sub-site.com returning main site option
- Language per user role, how can I achieve this?
- Admin users not able to see network menus
- WP-CLI Error Requesting CURL Extension
- Allowing users to manually add or remove themselves to/from WordPress multisite blogs
- wp cli search and replace on –network Error reconnecting to the database
- WordPress API – sign-up to multiple Multisites from one single form
- wp-cli core install –skip-email and –skip-config flags not working on MAMP unknown parameter
- Redirect a user roll to a page after login in mutlisite network
- User Roles in multisite – odd behavior
- WordPress single sign on using cookies with shared user role functionality between more than 2 wordpress subdomains
- How to automate adduser (on linux) when add new user site in multisite
- Activation of new Registered site fails on multisite
- How to force WP to create a users table in multisite configuration?
- How create a multisite setup with “phantom” accounts and passwords?
- Multisite vs Role Scoper
- Get users from all/specific blog by user_role and current_user role
- How can I display all Multisite blogs where this user is administrator?
- Multisite and users being listed on network administration dashboard and not main site dashboard
- Best way to convert two single WordPress sites into Multisite network with shared user base
- Advice on WP site structure using multisite
- Trying to create site-wide Active Directory sync with Multisite