wp_set_password

Definition:
function wp_set_password( $password, $user_id ) {}

Updates the user’s password with a new encrypted one.
For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.

Parameters

  • string $password: The plaintext new user password
  • int $user_id: User ID

Source code

function wp_set_password( $password, $user_id ) {

	global $wpdb;



	$hash = wp_hash_password($password);

	$wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) );



	wp_cache_delete($user_id, 'users');

}

4109

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: