-
-
Save mustardBees/a29a5b042dd28e22e0897a961f8cc883 to your computer and use it in GitHub Desktop.
WP-CLI: Add a user to all sites in a network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save script, run chmod +x on it, then... | |
# Usage: ./distribute_user.sh [username] [role] | |
ARGS="$@" | |
echo "Adding user $1 as $2 to all sites" | |
SITES=$(wp site list --field=url --format=csv) | |
for site in $SITES | |
do | |
wp user set-role $1 $2 --url=$site | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment