Clear webhook transients when status changes

Background discussion: https://github.com/woocommerce/woocommerce/pull/21427#discussion_r246881785
This commit is contained in:
Brent Shepherd 2019-01-17 15:55:54 +10:00
parent 28ca9f1ec4
commit 2ed2572afe
1 changed files with 4 additions and 0 deletions

View File

@ -152,6 +152,10 @@ class WC_Webhook_Data_Store implements WC_Webhook_Data_Store_Interface {
$webhook->apply_changes();
if ( isset( $changes['status'] ) ) {
// We need to delete all transients, because we can't be sure of the old status.
$this->delete_transients( 'all' );
}
wp_cache_delete( $webhook->get_id(), 'webhooks' );
WC_Cache_Helper::incr_cache_prefix( 'webhooks' );