wp_nonce_tick

Get the time-dependent variable for nonce creation.

Description

(float) wp_nonce_tick(); 

A nonce has a lifespan of two ticks. Nonces in their second tick may be updated, e.g. by autosave.

Returns (float)

Float value rounded up to the next highest integer.


Usage

  1. if ( !function_exists( 'wp_nonce_tick' ) ) { 
  2. require_once ABSPATH . WPINC . '/pluggable.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_nonce_tick(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/pluggable.php  
  1. function wp_nonce_tick() { 
  2. /** 
  3. * Filters the lifespan of nonces in seconds. 
  4. * @since 2.5.0 
  5. * @param int $lifespan Lifespan of nonces in seconds. Default 86, 400 seconds, or one day. 
  6. */ 
  7.  
  8. return ceil(time() / ( $nonce_life / 2 ));