Descripción

En wpforms_form_token_check_after_today se utiliza para ampliar los tiempos de caché utilizados para el token de formulario.

Parámetros

$tiempos
(matriz) Una matriz de tiempos para comprobar después de hoy.

Fuente

wpforms/src/Forms/Token.php

Más información

En wpforms_form_token_check_after_today puede ser usado para extender los tiempos de caché que WPForms usa en los tokens de los formularios para los after times.

Este filtro se utiliza principalmente para detectar casos extremos, como la carga y el envío de la página del formulario en dos días diferentes.

Hay otro filtro disponible para ampliar los tiempos de caché antes también. Consulte el filtro wpforms_form_token_check_before_today filtro.

Ejemplo

/**
 * 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' );

Referencia del artículo: Cómo cambiar el tiempo de caché de su token de formulario

Referencia de filtro adicional: wpforms_form_token_check_before_today