Skip to main content

benecaster_get_email_log_retention_days()

Utilities Free
benecaster_get_email_log_retention_days(): int

Returns how long Benecaster keeps its record of sent email. A daily job deletes email log rows, and the stored copies of sent or failed emails, once they are older than this; emails still waiting to send are never deleted.

Return Value

Type: int

How many days Benecaster keeps the email log and the stored copy of each sent email: 180 unless changed. A value below 1 means everything is kept.

Example

$days = benecaster_get_email_log_retention_days();
if ( $days >= 1 ) {
    printf(
        esc_html__( 'Emails can be resent for %d days after they were sent.', 'my-addon' ),
        (int) $days
    );
}

Hooks Fired

Notes

Use it to say how far back a resend reaches. Resending re-sends the stored copy, so an email older than this window has nothing left to resend.

The value passes through the benecaster_email_log_retention_days filter, so call this function rather than applying the filter yourself.

Need this built rather than just documented? See our services →