Skip to content
Docs
Get RestroPress

Action

rpress_pre_delete_customer

Updated
On this page

Fires before a customer is trashed or permanently deleted from the admin.

Runs before the customer record is trashed, before it is permanently deleted and for each customer in the trash and delete-permanently bulk actions. The second argument is always true and the third tells whether related data will be removed. When trashing, and when bulk deleting permanently, the third argument is false.

Parameters#

ParameterTypeDescription
$customer_idintThe customer ID.
$confirmboolAlways true; the deletion has been confirmed.
$remove_databoolWhether the customer's linked data is also being removed.

Example#

function my_before_customer_delete( $customer_id, $confirm, $remove_data ) {
	delete_option( 'my_loyalty_' . $customer_id );
}
add_action( 'rpress_pre_delete_customer', 'my_before_customer_delete', 10, 3 );

Notes#

Fired from the single trash action, the single permanent delete action (where the third argument is the checkbox choice) and the list table bulk actions. Move to trash also fires it, so data is not necessarily gone afterwards.

Source#

Fired from:

  • includes/admin/customers/customer-actions.php (line 477), in rpress_customer_delete()
  • includes/admin/customers/customer-actions.php (line 549), in rpress_customer_delete_permanently()
  • includes/admin/customers/customer-actions.php (line 611), in rpress_customers_list_table_process_bulk_actions()
  • includes/admin/customers/customer-actions.php (line 622), in rpress_customers_list_table_process_bulk_actions()
Was this page helpful?