wp_update_user() does not update user_data

The function needs an array with the parameters. See The Codex.
Also, you map the parameter with the value: ex. 'user_email' => $_POST['user_email'].

In your example, the code would look like this:

    $user_id = (int) $_POST[ 'ID' ];
    wp_update_user( array(
        'ID' => $user_id,
        'user_email' => $_POST[ 'user_email' ]
   ) );

Also, the important hint: you should validate the data. Especially the data from the $_POST array. Maybe you’re doing this, and it is not in your example source.

Leave a Comment