WC_Webhook_Data_Store::delete
Remove a webhook from the database.
Method of the class: WC_Webhook_Data_Store{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$WC_Webhook_Data_Store = new WC_Webhook_Data_Store(); $WC_Webhook_Data_Store->delete( $webhook );
- $webhook(WC_Webhook) (required) (passed by reference — &)
- Webhook instance.
Changelog
| Since 3.3.0 | Introduced. |
WC_Webhook_Data_Store::delete() WC Webhook Data Store::delete code WC 10.3.5
public function delete( &$webhook ) {
global $wpdb;
$wpdb->delete(
$wpdb->prefix . 'wc_webhooks',
array(
'webhook_id' => $webhook->get_id(),
),
array( '%d' )
); // WPCS: cache ok, DB call ok.
$this->delete_transients( 'all' );
wp_cache_delete( $webhook->get_id(), 'webhooks' );
WC_Cache_Helper::invalidate_cache_group( 'webhooks' );
do_action( 'woocommerce_webhook_deleted', $webhook->get_id(), $webhook );
}