apply_filters( 'nonce_life', int $lifespan, string|int $action )
- Since
- 2.5.0, 6.1.0
Filters the lifespan of nonces in seconds.
Compatibility
- WordPress
- since 6.1.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$lifespanint- Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
$actionstring|int- The nonce action, or -1 if none was provided.
Where this hook fires · 1
wp-includes/pluggable.php:2448wp_nonce_tick()
Source code
* @since 2.5.0 * @since 6.1.0 Added `$action` argument to allow for more targeted filters. * * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day. * @param string|int $action The nonce action, or -1 if none was provided. */ $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS, $action ); return ceil( time() / ( $nonce_life / 2 ) ); }endif; if ( ! function_exists( 'wp_verify_nonce' ) ) :Changelog
Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.1.0
Added
$action argument to allow for more targeted filters.from the docblock2.5.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.9.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.