wp-cli is great. But it’s not clear how I can quickly change a user password with it.
How to change a user’s password programatically can probably help to figure this out.
Although wp user update username --field=password is not gonna cut it, apparently md5 is deprecated so it should go through wp_set_password.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
This does the trick:
wp user update USERNAME --user_pass="PASSWORD"
(Found it here.)
Method 2
first check the user name:
wp user list
then change password without leaving traces in history
wp user update admin --prompt=user_pass
Method 3
Just to append one minor thing; sometimes the password may start with the = character. I prefer using this notation, just because of that.
wp user update USERNAME --user_pass="PASSWORD"
Method 4
I have found that sudo definitely changes the path, so I have tried using –allow-root without sudo and the commands work
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0