Action fires immediately after a new user is registered.


(int) User ID of the current viewer, or 0 if the current viewer is not logged in.
(array) Sanitized entry field values/properties.
(array) Processed form settings/data, prepared to be used later.
(array) WP_User object with the information pertaining to the user whose ID is passed.



More Information

This action is called immediately after a new user is registered through the WPForms User Registration addon.


Just remember to change the form ID from 5 to match your form ID.

 * Action that fires just after the submit button is clicked on user registration form.
 * @link
 * @param int    $user_id    User ID of the current viewer.
 * @param array  $fields     Original $_POST global.
 * @param array  $form_data  Form data and settings.
 * @param int    $userdata   WP_User object with information from user ID.

function wpf_dev_user_registered( $user_id, $fields, $form_data, $userdata ) {
    // Only run on my form with ID = 5
    if ( absint( $form_data['id'] ) !== 5 ) {
    // Run code.

add_action( 'wpforms_user_registered', 'wpf_dev_user_registered', 10, 4 );

Snippet Reference: How to Automatically Log in Users After Registration