Skip to main content

benecaster_email_log_retention_days

Filter Free

Filters the email log retention period (in days) used by the orphaned data scanner when identifying stale email log entries. The default is 180 days.

This filter controls what the scanner considers stale — it does not trigger automatic deletion. Rows older than the returned value are surfaced as cleanable in Benecaster → Settings → Tools → Maintenance, but removing them always requires explicit admin confirmation. The unsubscribe log is excluded from this retention policy and is never flagged by the scanner.

Parameters

Name Type Default Description
$days int Retention period in days; default 180

Returns: int

Examples

Extend retention to two years

add_filter( 'benecaster_email_log_retention_days', function( $days ) {
    // Extend log retention to 730 days (2 years) for compliance.
    return 730;
} );

Reduce retention for high-volume show

add_filter( 'benecaster_email_log_retention_days', function ( int $days ): int {
    return 90;
} );

Notes

This filter controls what is surfaced by the scanner as cleanable — not what is automatically deleted. Orphaned data cleanup always requires admin confirmation in the Maintenance screen. The unsubscribe log is never subject to this policy and is always excluded from automated cleanup.

Affects

  • Email log retention cron