global $current_user;
get_currentuserinfo();
if (isset($_POST['email'])) {
wp_update_user( array('ID' => $current_user->ID, 'user_email' => $_POST['email']) );
unset($current_user);
get_currentuserinfo(); //just in case
}
echo '<p>You'll recieve a mail here: ' . $current_user->user_email . '</p>';
Now it should work, the problem was on the get_currentuserinfo()
function, because it checks if the variable is already set and is an instace of WP_User
, if it is, the function “aborts” (returns) and doesn’t update the variable.