Skip to content

Instantly share code, notes, and snippets.

@markbiek
Created January 17, 2017 16:25
Show Gist options
  • Save markbiek/69a46d8d1ee7fc0906f77ee3461e5475 to your computer and use it in GitHub Desktop.
Save markbiek/69a46d8d1ee7fc0906f77ee3461e5475 to your computer and use it in GitHub Desktop.
add_action('user_register', 'handle_user_register', 10, 1);
function handle_user_register($user_id) {
/*
* When a new user registers, write all POST values to user_meta.
* This way, they're accessible on when the new-user email is sent through wp_mail.
* Otherwise values like first & last name aren't accessible in the email
*/
foreach ($_POST as $key => $val) {
update_user_meta($user_id, $key, $_POST[$key]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment