Title: nonce_life
Published: April 25, 2014
Last modified: August 20, 2026

---

# apply_filters( ‘nonce_life’, int $lifespan, string|int $action )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#wp--skip-link--target)

Filters the lifespan of nonces in seconds.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#parameters)󠁿

 `$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.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#source)󠁿

    ```php
    $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS, $action );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/pluggable.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/pluggable.php#L2454)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/pluggable.php#L2454-L2454)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_nonce_tick()](https://developer.wordpress.org/reference/functions/wp_nonce_tick/)`wp-includes/pluggable.php` |

Returns the time-dependent variable for nonce creation.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/nonce_life/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Added `$action` argument to allow for more targeted filters. | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fnonce_life%2F)
before being able to contribute a note or feedback.