wp_nonce_tick

The timeline below displays how wordpress function wp_nonce_tick has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Returns the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5.0
 * @since 6.1.0 Added `$action` argument.
 *
 * @param string|int $action Optional. The nonce action. Default -1.
 * @return float Float value rounded up to the next highest integer.
 */
function wp_nonce_tick($action = -1)
{
    /**
     * Filters the lifespan of nonces in seconds.
     *
     * @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));
}

WordPress Version: 5.3

/**
 * Returns the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5.0
 *
 * @return float Float value rounded up to the next highest integer.
 */
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));
}

WordPress Version: 4.6

/**
 * Get the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5.0
 *
 * @return float Float value rounded up to the next highest integer.
 */
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));
}

WordPress Version: 4.1

/**
 * Get the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5.0
 *
 * @return float Float value rounded up to the next highest integer.
 */
function wp_nonce_tick()
{
    /**
     * Filter 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));
}

WordPress Version: 3.9

/**
 * Get the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5.0
 *
 * @return int
 */
function wp_nonce_tick()
{
    /**
     * Filter 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));
}

WordPress Version: 3.7

/**
 * Get the time-dependent variable for nonce creation.
 *
 * A nonce has a lifespan of two ticks. Nonces in their second tick may be
 * updated, e.g. by autosave.
 *
 * @since 2.5
 *
 * @return int
 */
function wp_nonce_tick()
{
    $nonce_life = apply_filters('nonce_life', DAY_IN_SECONDS);
    return ceil(time() / ($nonce_life / 2));
}