Helps you change the password of a user on multiple WordPress sites quickly.
Imagine having accounts on different WordPress sites that have the same username and password, and suddenly you get the urge to change your password for all these sites. This script logs in and uses the profile page to change it.
This script makes use of PhantomJS (A headless browser) and CasperJS (Navigating scripting) to login to the WP sites, change the password, and return feedback of the result.
Sure thing, just follow the steps below:
- Install PhantomJS
- Install CasperJS
- Alter the default variables in the script
sLoginName
,sLoginPassword
andsNewPassword
. - Run the script for a single site to make sure it's working correctly using the following command:
casperjs src/wp-bulk-psw-change.js http://www.your.site
- By default the script uses the 'wp-admin' path to log in, you can change this using: --adminpath="my-hidden-backend-path"
- If all goes well you should see a green-colored message like this:
WP notice: Profile updated
.
- Please beware: This doesn't always mean it was successful. If you update a password on the profile page WP returns a with classes
notice
andupdated
. This can be the success message, but also a message from a plug-in. There is no way to check if it really was succesfull because the message is dependent on the language you run the WP backend in.
Calm down, you can automate it for more sites using Bash to feed your URL's
-
Create a textfile (sites.txt) containing all your URL's, 1 per line
-
Use bash to run the script on every of the sites with this command:
for i in 'cat sites.txt'; do src/wp-bulk-psw-change.js $i; done
Q: Why not use WP-CLI for changing passwords?
A: Well... you should! But unfortunately it's not always available on your hosting.
Q: Which WordPress versions does it work with?
A: I've only tested it with 4.9.x so far.
Q: Does it also work with captcha protected logins?
A: No, it's just a login script, not Skynet.