WC_Admin_Webhooks::bulk_delete
Bulk delete.
Method of the class: WC_Admin_Webhooks{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Admin_Webhooks::bulk_delete( $webhooks );
- $webhooks(array) (required)
- List of webhooks IDs.
WC_Admin_Webhooks::bulk_delete() WC Admin Webhooks::bulk delete code WC 10.8.1
public static function bulk_delete( $webhooks ) {
foreach ( $webhooks as $webhook_id ) {
$webhook = new WC_Webhook( (int) $webhook_id );
$webhook->delete( true );
}
$qty = count( $webhooks );
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$status = isset( $_GET['status'] ) ? '&status=' . sanitize_text_field( wp_unslash( $_GET['status'] ) ) : '';
// Redirect to webhooks page.
wp_safe_redirect( admin_url( 'admin.php?page=wc-settings&tab=advanced§ion=webhooks' . $status . '&deleted=' . $qty ) );
exit();
}