Last active
November 24, 2021 12:28
-
-
Save chrisjangl/d1a350caf0ddfea95edbf82c5f95cbab to your computer and use it in GitHub Desktop.
Working from a list of WordPress sites on a shared hosting environment (sites.txt), reset the password for a given user account on each of them. It also creates a report of the admin users on each site
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
i=1 | |
touch users.txt | |
COUNT=$(wc -l sites.txt) | |
for SITE in $(cat sites.txt) | |
do | |
cd $SITE | |
echo "Working on $SITE ($i of $COUNT)..." | |
echo "## $SITE" >> ../users.txt | |
wp user list --role=administrator --fields=user_login,user_email >> ../users.txt | |
echo "----------------" >> ../users.txt | |
echo " " >> ../users.txt | |
echo " " >> ../users.txt | |
echo " " >> ../users.txt | |
wp user update <user_login> --user_pass=<user_pass> | |
((i=i+1)) | |
clear | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment