wp_set_password

Advertisement

Summery Summery

Updates the user’s password with a new encrypted one.

Syntax Syntax

wp_set_password( string $password, int $user_id )

Description Description

For integration with other applications, this function can be overwritten to instead use the other package password checking algorithm.

Please note: This function should be used sparingly and is really only meant for single-time application. Leveraging this improperly in a plugin or theme could result in an endless loop of password resets if precautions are not taken to ensure it does not execute on every page load.

Parameters Parameters

$password

(Required) The plaintext new user password

$user_id

(Required) User ID

Source Source

File: wp-includes/pluggable.php

	 * of password resets if precautions are not taken to ensure it does not execute on every page load.
	 *
	 * @since 2.5.0
	 *
	 * @global wpdb $wpdb WordPress database abstraction object.
	 *
	 * @param string $password The plaintext new user password
	 * @param int    $user_id  User ID
	 */
	function wp_set_password( $password, $user_id ) {
		global $wpdb;

		$hash = wp_hash_password( $password );
		$wpdb->update(
			$wpdb->users,

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Advertisement

Leave a Reply