Riepilogo AI
Descrizione
Il wpforms_form_token_check_after_today viene utilizzato per estendere i tempi di cache utilizzati per il token del modulo.
Parametri
- $tempi
- (array) Un array di orari da controllare dopo oggi.
Fonte
wpforms/src/Forms/Token.php
Ulteriori informazioni
Il wpforms_form_token_check_after_today può essere usato per estendere i tempi di cache che WPForms usa sui token del modulo per i tempi successivi.
Questo filtro viene utilizzato soprattutto per individuare casi limite, come il caricamento e l'invio della pagina del modulo in due giorni diversi.
È disponibile un altro filtro per estendere i tempi di cache anche in precedenza. Si veda la sezione wpforms_form_token_check_before_today filtro.
Esempio
/**
* Extend cache time on form tokens before today.
*
* @param array $times An array of times to check before today.
* @return array
*/
function example_add_longer_token_time_before( $times ) {
// Allow the token to persist for 3, 4, and 5 days
$times[] = 3 * DAY_IN_SECONDS;
$times[] = 4 * DAY_IN_SECONDS;
$times[] = 5 * DAY_IN_SECONDS;
return $times;
}
add_filter( 'wpforms_form_token_check_before_today', 'example_add_longer_token_time_before' );
/**
* Extend cache time on form tokens after today.
*
* This filter is to catch edge cases of someone loading the form and submitting,
* with the expiration happening in between. Making this longer allows for more leeway.
*
* @param array $times An array of times to check after today.
* @return array
*/
function example_add_longer_token_time_after( $times ) {
// Allow the token to persist for 1 day
$times[] = DAY_IN_SECONDS;
return $times;
}
add_filter( 'wpforms_form_token_check_after_today', 'example_add_longer_token_time_after' );
Correlato
Riferimento all'articolo: Come modificare il tempo di cache del token del modulo
Filtro aggiuntivo di riferimento: wpforms_form_token_check_before_today