Skip to content

Commit 990d6bf

Browse files
committed
Added lhr_expiration_days hook
1 parent ff9e9f7 commit 990d6bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

log-http-requests.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ function cleanup() {
7575
global $wpdb;
7676

7777
$now = current_time( 'timestamp' );
78-
$yesterday = date( 'Y-m-d H:i:s', strtotime( '-1 day', $now ) );
79-
$wpdb->query( "DELETE FROM {$wpdb->prefix}lhr_log WHERE date_added < '$yesterday'" );
78+
$expires = apply_filters( 'lhr_expiration_days', 1 );
79+
$expires = date( 'Y-m-d H:i:s', strtotime( '-' . $expires . ' days', $now ) );
80+
$wpdb->query( "DELETE FROM {$wpdb->prefix}lhr_log WHERE date_added < '$expires'" );
8081
}
8182

8283

0 commit comments

Comments
 (0)