WC_Logger::clear_expired_logs()
Clear all logs older than a defined number of days. Defaults to 30 days.
Method of the class: WC_Logger{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WC_Logger = new WC_Logger(); $WC_Logger->clear_expired_logs();
WC_Logger::clear_expired_logs() WC Logger::clear expired logs code WC 9.3.3
public function clear_expired_logs() { $days = LoggingUtil::get_retention_period(); $timestamp = strtotime( "-{$days} days" ); foreach ( $this->get_handlers() as $handler ) { if ( is_callable( array( $handler, 'delete_logs_before_timestamp' ) ) ) { $handler->delete_logs_before_timestamp( $timestamp ); } } }