WC_Webhook_Data_Store::delete()publicWC 3.3.0

Remove a webhook from the database.

Method of the class: WC_Webhook_Data_Store{}

Hooks from the method

Return

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() code WC 9.4.2

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 );
}