Created
January 21, 2021 03:49
-
-
Save lsemenenko/8282e34ef722e9e75843396ea3d13607 to your computer and use it in GitHub Desktop.
Change all users with specific role to another role across MU network with WP-CLI
This file contains hidden or 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
for i in $(sudo -u www-data wp site list --field=url); \ | |
do | |
echo ${i}; \ | |
a="$(sudo -u www-data wp user list --url=${i} --role=SuperUser --field=user_login)"; \ | |
if [[ ! -z "${a}" ]]; then \ | |
sudo -u www-data wp user --url="${i}" update "${a}" --role "administrator"; \ | |
echo "User ${a} updated for site ${i}."; \ | |
fi; \ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment