Function: wp_create_user_request

wp_create_user_request( string $email_address, string $action_name, array $request_data )

Create and log a user request to perform a specific action.

Requests are stored inside a post type named user_request since they can apply to both users on the site, or guests without a user account.

Parameters

Name Type(s) Default Value Description
$email_address string ''

User email address. This can be the address of a registered or non-registered user.

$action_name string ''

Name of the action that is being confirmed. Required.

$request_data array array()

Misc data you want to send with the verification request and pass to the actions once the request is confirmed.

Returns

integer | WP_Error

Returns the request ID if successful, or a WP_Error object on failure.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.