Action Hook since 2.0.0
user_register
Fires immediately after a new user is registered
Description
user_register fires right after wp_insert_user() writes the row — the account exists but you're still inside the registration request, which matters for redirects and emails.
When it runs
Inside wp_insert_user(), after the user row and default meta are written.
Signature
do_action( 'user_register', int $user_id, array $userdata );Parameters
$user_idint — ID of the newly registered user.$userdataarray — Raw array of user data used to create the account.
Examples
Basic
add_action( 'user_register', function( $user_id ) {
$user = new WP_User( $user_id );
$user->set_role( 'subscriber' );
wp_mail( $user->user_email, 'Welcome!', 'Thanks for registering.' );
} );Assign a default role and send a welcome email on signup.
Common Use Cases
- Send welcome emails
- Assign a default role
- Sync new users to a CRM/mailing list
- Set default user meta on signup
Common mistakes
- Relying on this hook for social/SSO logins that create users a different way (some plugins bypass wp_insert_user)
Related hooks
FAQ
Does user_register fire for users created in wp-admin by an administrator?
Yes — any path that goes through wp_insert_user() triggers it, including admin-created accounts and REST API user creation.
Source: wp-includes/user.php