WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a totally different profile page (not the one provided by Wordpress), since the layout and feel of the default profile page is too "Wordpress" for the users. Now I am successful in being able to present a page that can modify user meta data like firstname, lastname, city, zip code, etc.

Now what stumped me is changing the password of the user. Is there any built-in wordpress function, say change_user_password($user_id, $new_password)? I'm surprised that I can't look for anything that does this.

Worse comes to worst I'm doing an UPDATE wp_users SET user_pass = md5($new_password) WHERE ID = $user_id, but I would be really amazed if there is no function for this one.

share|improve this question
md5 for passwords in WordPress is deprecated (but still backwards compatible - next time user logins password will be re-hashed and re-saved). It is better to go through API so that current and more complex hashing scheme is used. – Rarst Feb 21 '11 at 10:27
Yeah, I that's my guess as well. The passwords stored in the database does not match an MD5 with the incoming password. So yeah, it is indeed rehashed. – Ardee Aram Feb 28 '11 at 7:14
up vote 12 down vote accepted
wp_set_password( $password, $user_id );

See reference for details.

share|improve this answer
I up voted this essentially because this results in single sql query. Excellent, if the password is, all that you want to update. wp_update_user results in about 14 queries running. – John Jul 16 '12 at 19:31

A simple wp_update_user(array('ID' => $userid, 'user_pass' => 'myNeWpaSSword')) will do everything for you - wp_update_user() (Codex).

On a sidenote: are you aware of the Theme My Login (Wordpress Plugin)? It can provide you with a front-end side profile page.

share|improve this answer
There we go! Thank you! – Ardee Aram Feb 21 '11 at 2:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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