WordPress filter hook · part of WordPress core
nonce_life
A WordPress core filter that 28 plugins also fire themselves, running on 7.3M+ sites between them.
“Filters the lifespan of nonces in seconds.”
How to use nonce_life
It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'nonce_life', function( $value, $action ) {
// Change $value here.
return $value;
}, 10, 2 );Argument names come from LiteSpeed Cache's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
28 plugins that fire nonce_life
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
LiteSpeed Cache7+ million installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, $action )src/esi.cls.php:950 -
GiveWP100,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/misc-functions.php:1977 -
hCaptcha for WP70,000+ installs
apply_filters( 'nonce_life', constant( 'DAY_IN_SECONDS' ) )src/php/AutoVerify/AutoVerify.php:924 -
Uncanny Automator40,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )src/core/services/rest-routes.php:399 -
IP Location Block10,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )src/Support/Util.php:741 -
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN10,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, (string) $action )includes/class-cache.php:5548 -
Pantheon Advanced Page Cache10,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )inc/admin-interface.php:670 -
IP Geo Block7,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )classes/class-ip-geo-block-util.php:381 -
FAZ Cookie Manager3,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/class-dsar-shortcode.php:1220 -
Premium Blocks2,000+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, 'pbg_form_nonce' )classes/class-pbg-blocks-helper.php:985 -
BaseCloud Boost50+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, 'gform_ajax_submission' )includes/Core/Token_Expiry.php:73 -
Gratora40+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, 'wp_rest' )src/Core/Commands/CoreCommandProvider.php:1845 -
Presentero30+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, self::NONCE )includes/class-presentero-gc-ajax.php:89 -
Noncensible20+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, $action )noncensible.php:40 -
Ask My Content20+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )ask-my-content.php:206 -
Gorilla Cache20+ installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/class-gorillacache-installer.php:592 -
Coyote Speed for DiviFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/class-cache.php:171 -
Pixel Made SimpleFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, self::NONCE_ACTION )includes/class-pxms-forms.php:89 -
MapsembleFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )src/Admin/BlockPreview.php:222 -
Visual Edit LiteFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/class-forms.php:485 -
PlattivoFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, 'wp_rest' )src/Rest/AuthController.php:69 -
Rox Rental BookingFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )src/Modules/Frontend/Services/PublicConfigService.php:126 -
Mix News ToolsFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, 'mix-news-view-' . get_queried_object_id() )inc/performance.php:120 -
CachelumeFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/CacheHandler.php:367 -
Nonce Failure ExplainerFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS )includes/class-noncfaex-environment.php:36 -
ZeroConfigFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, '' )includes/class-page-cache.php:370 -
Edge Doctor for Cloudflare®Fewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, -1 )src/Check/PrivateCache/C6NonceAge.php:239 -
Thorakis CacheFewer than 10 installs
apply_filters( 'nonce_life', DAY_IN_SECONDS, -1 )src/Config/Ttl.php:62
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.