Action
rpress_pre_delete_customer
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#
| Parameter | Type | Description |
|---|---|---|
$customer_id | int | The customer ID. |
$confirm | bool | Always true; the deletion has been confirmed. |
$remove_data | bool | Whether 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), inrpress_customer_delete()includes/admin/customers/customer-actions.php(line 549), inrpress_customer_delete_permanently()includes/admin/customers/customer-actions.php(line 611), inrpress_customers_list_table_process_bulk_actions()includes/admin/customers/customer-actions.php(line 622), inrpress_customers_list_table_process_bulk_actions()
Was this page helpful?
