Codex tools: Log in
Languages: English • 한국어 • (Add your language)
Contents |
Update a user in the database.
It is possible to update a user's password by specifying the 'user_pass' value in the $userdata parameter array.
If $userdata does not contain an 'ID' key, then a new user will be created and the new user's ID will be returned.
If current user's password is being updated, then the cookies will be cleared.
Note: Use the wp_insert_user function to create a new user.
<?php wp_update_user( $userdata ) ?>
Below is an example showing how to update a user's Website profile field
<?php
require_once( ABSPATH . WPINC . '/registration.php');
$user_id = 1;
$website = 'http://wordpress.org';
wp_update_user( array ('ID' => $user_id, 'user_url' => $website) ) ;
?>
wp_update_user() is located in wp-includes/user.php.