nonce_life
Filters the lifespan of nonces in seconds.
Usage
add_filter( 'nonce_life', 'wp_kama_nonce_life_filter', 10, 2 ); /** * Function for `nonce_life` filter-hook. * * @param int $lifespan Lifespan of nonces in seconds. * @param string|int $action The nonce action, or -1 if none was provided. * * @return int */ function wp_kama_nonce_life_filter( $lifespan, $action ){ // filter... return $lifespan; }
- $lifespan(int)
- Lifespan of nonces in seconds.
Default: 86,400 seconds, or one day - $action(string|int)
- The nonce action, or -1 if none was provided.
Changelog
Since 2.5.0 | Introduced. |
Since 6.1.0 | Added $action argument to allow for more targeted filters. |
Where the hook is called
nonce_life
wp-includes/pluggable.php 2293
$nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS, $action );