Closed NickGreen closed 5 months ago
I think we ought to be able to run something like this when the plugin is running its deletion stuff:
function disable_woocommerce_webhooks() {
$webhooks = wc_get_webhooks( array( 'status' => 'active' ) );
if ( ! empty( $webhooks ) ) {
foreach ( $webhooks as $webhook_id ) {
$webhook = new WC_Webhook( $webhook_id );
$webhook->set_status( 'disabled' );
$webhook->save();
}
}
}
Alternately, if we wanted to just wipe them, we could do so from the DB like this:
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = 'shop_webhook');
DELETE FROM wp_posts WHERE post_type = 'shop_webhook';
EDIT: this is old info. Webhooks are now stored in the wp_wc_webhooks
table
Did both here: https://github.com/a8cteam51/safety-net/pull/119
Can't think of any reason why a development site should be sending information to a 3rd party website via webhooks, so let's see if we can disable all of the existing webhooks that you might find here: /wp-admin/admin.php?page=wc-settings&tab=advanced§ion=webhooks
Alternately, we might be able to delete them if that's the best option.
Screenshot of webhooks settings page: