WC_Webhook_Data_Store::delete_transients()privateWC 3.6.0

Delete the transients used to cache a set of webhook IDs, optionally filtered by status.

Method of the class: WC_Webhook_Data_Store{}

No Hooks.

Return

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->delete_transients( $status );
$status(string)
Optional - status of cache to delete, or 'all' to delete all caches.
Default: ''

Changelog

Since 3.6.0 Introduced.

WC_Webhook_Data_Store::delete_transients() code WC 8.7.0

private function delete_transients( $status = '' ) {

	// Always delete the non-filtered cache.
	delete_transient( $this->get_transient_key( '' ) );

	if ( ! empty( $status ) ) {
		if ( 'all' === $status ) {
			foreach ( wc_get_webhook_statuses() as $status_key => $status_string ) {
				delete_transient( $this->get_transient_key( $status_key ) );
			}
		} else {
			delete_transient( $this->get_transient_key( $status ) );
		}
	}
}