I want to make a user-create snippet, but it must not includes plain password.

   $ wp user create username username@example.com --role=administrator --user_pass=password

So can I create (or update) user password by hashed value?


This should work:

wp user update USERNAME --user_pass=PASSWORD

Found it here

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – cjbj Dec 5 '16 at 12:32
  • 1
    @cjbj The link was simply stating where I got the answer from... It has nothing to do with the actual answer – yobddigi Dec 5 '16 at 12:37
  • Is it plain text password, isn't it? – Youichi Okada Dec 6 '16 at 2:02

I know this is an old question, but I found this while looking for a similar solution. Best solution (unless you alter the DB directly) seems to be the --prompt argument. You can pass the new password over stdin with

wp user update <USER> --prompt=user_pass

This avoids having the PW show up in your history/process list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.