woocommerce_logger_delete_expired_file
Allows preventing an expired log file from being deleted.
Usage
add_filter( 'woocommerce_logger_delete_expired_file', 'wp_kama_woocommerce_logger_delete_expired_file_filter', 10, 3 ); /** * Function for `woocommerce_logger_delete_expired_file` filter-hook. * * @param bool $delete True to delete the file. * @param File $file The log file object. * @param int $timestamp The expiration threshold. * * @return bool */ function wp_kama_woocommerce_logger_delete_expired_file_filter( $delete, $file, $timestamp ){ // filter... return $delete; }
- $delete(true|false)
- True to delete the file.
- $file(File)
- The log file object.
- $timestamp(int)
- The expiration threshold.
Changelog
Since 8.7.0 | Introduced. |
Where the hook is called
woocommerce_logger_delete_expired_file
woocommerce/src/Internal/Admin/Logging/LogHandlerFileV2.php 258
$delete = apply_filters( 'woocommerce_logger_delete_expired_file', true, $file, $timestamp );