Skip to content
Docs
Get RestroPress

Filter

rpress_insert_user_args

Updated
On this page

Filters the arguments used to create a new user during checkout registration.

Runs in rpress_register_and_login_new_user before wp_insert_user() is called. The array contains user_login, user_pass, user_email, first_name, last_name, user_registered and role (the site default role). Use it to change the role or add fields accepted by wp_insert_user().

Parameters#

ParameterTypeDescription
$user_argsarrayArguments for wp_insert_user().
$user_dataarrayRegistration data submitted at checkout (user_login, user_pass, user_email, user_first, user_last).

Return value#

array. Arguments passed to wp_insert_user().

Example#

function my_new_user_args( $user_args, $user_data ) {
	$user_args['display_name'] = trim( $user_args['first_name'] . ' ' . $user_args['last_name'] );
	return $user_args;
}
add_filter( 'rpress_insert_user_args', 'my_new_user_args', 10, 2 );

Source#

Applied in:

  • includes/process-purchase.php (line 827), in rpress_register_and_login_new_user()

See also#

Was this page helpful?