Skip to content
Docs
Get RestroPress

Action

rpress_detach_deleted_user

Updated
On this page

Fires after a deleted WordPress user is detached from their customer record.

Runs in rpress_detach_deleted_user(), which is hooked to the WordPress delete_user action. If a matching customer exists, its user_id is set to 0 first. The customer record itself is kept.

Parameters#

ParameterTypeDescription
$user_idintID of the user being deleted.
$customerRPRESS_CustomerThe customer object looked up by user ID. Its id is 0 when no customer exists.
$detachedbool|intResult of the customer update, or false if no customer was found.

Example#

function my_after_detach_user( $user_id, $customer, $detached ) {
	if ( $detached && $customer->id > 0 ) {
		error_log( sprintf( 'Customer %d detached from deleted user %d.', $customer->id, $user_id ) );
	}
}
add_action( 'rpress_detach_deleted_user', 'my_after_detach_user', 10, 3 );

Source#

Fired from:

  • includes/user-functions.php (line 870), in rpress_detach_deleted_user()
Was this page helpful?