user_register WordPress Action Hook

The user_register hook is used to trigger a user registration event. This hook is used by the WordPress core registration system to create new user accounts. It is also used by other plugins and themes to perform actions when a new user registers on the site.

do_action( 'user_register', int $user_id, array $userdata ) #

Fires immediately after a new user is registered.


Parameters

$user_id

(int)User ID.

$userdata

(array)The raw array of data passed to wp_insert_user().


Top ↑

More Information

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument.

Not all user meta data has been stored in the database when this action is triggered. For example, nickname is in the database but first_name and last_name are not (as of v3.9.1). The password has already been encrypted when this action is triggered.

Typically, this hook is used for saving additional user meta passed by custom registration forms.


Top ↑

Source

File: wp-includes/user.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.8.0The $userdata parameter was added.
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More