void { if ( ! $this->need_cleanup() ) { return; } global $wpdb; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_wc_filter_data_' ) . '%', $wpdb->esc_like( '_transient_timeout_wc_filter_data_' ) . '%' ) ); } /** * Check if the filter data cache should be cleaned up. * If the cache group is not set, it means that the store is not using * the product filters and we don't need to register the hooks. * * @return bool */ public function need_cleanup() { return ! empty( get_transient( self::CACHE_GROUP . '-transient-version' ) ); } }