wp_nonce_tick() WordPress Function

The wp_nonce_tick() function is used to generate a nonce (number used once) for a user. A nonce is a number that is used once and then expires. This function is used to generate a nonce that will be used for the current user.

wp_nonce_tick() #

Returns the time-dependent variable for nonce creation.


Description

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


Top ↑

Return

(float) Float value rounded up to the next highest integer.


Top ↑

Source

File: wp-includes/pluggable.php

	function wp_nonce_tick() {
		/**
		 * Filters the lifespan of nonces in seconds.
		 *
		 * @since 2.5.0
		 *
		 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
		 */
		$nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );

		return ceil( time() / ( $nonce_life / 2 ) );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More