Function: wp_update_user

wp_update_user( object | WP_User $userdata )

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 current user's password is being updated, then the cookies will be cleared.


Name Type(s) Default Value Description
$userdata object | WP_User

An array of user data or a user object of type stdClass or WP_User.


integer | WP_Error

The updated user's ID or a WP_Error object if the user could not be updated.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.