WC_Logger::clear_expired_logs()
Clear all logs older than a defined number of days. Defaults to 30 days.
Description Description
Source Source
File: includes/class-wc-logger.php
public function clear_expired_logs() {
$days = absint( apply_filters( 'woocommerce_logger_days_to_retain_logs', 30 ) );
$timestamp = strtotime( "-{$days} days" );
foreach ( $this->handlers as $handler ) {
if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) {
$handler->delete_logs_before_timestamp( $timestamp );
}
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.4.0 | Introduced. |