I’m trying to delete all WooCommerce webhooks, but after doing so they still appear as “Disabled” in the advanced settings -> webhooks interface.
I’ve been trying to do this:
$webhook_ids = $wpdb->get_col("SELECT webhook_id FROM {$wpdb->prefix}wc_webhooks");
foreach( $webhook_ids as $webhook_id )
{
// Get the webhook
$webhook = new WC_Webhook( $webhook_id );
// Delete the webhook
$webhook->delete( TRUE ); // true to force delete
}
I’ve even tried doing this:
$wpdb->query("DELETE FROM wp_wc_webhooks");
And I’ve also tried doing this:
$webhook_ids = $wpdb->get_col("SELECT webhook_id FROM {$wpdb->prefix}wc_webhooks");
foreach( $webhook_ids as $webhook_id )
{
// Get the webhook
$webhook = new WC_Webhook( $webhook_id );
// Delete the webhook
$webhook->delete( TRUE ); // true to force delete
$WC_Webhook_Data_Store = new WC_Webhook_Data_Store();
$WC_Webhook_Data_Store->delete( $webhook );
}
No matter what I do, the result is the same. A list of “Disabled” webhooks in the admin area. What’s interesting is that the wp_wc_webhooks table is empty. I know there is a cache, but I was under the impression that using the delete method of the WC_Webhook_Data_Store should clear it.
What can I do to get rid of these pesky “Disabled” webhooks?