wp_create_nonce() – Creates a cryptographic token tied to a specific action, user, user session, and window of time.
Description
Creates a cryptographic token tied to a specific action, user, user session, and window of time.
Usage
$string = wp_create_nonce( $action );
Parameters
- $action
- ( string|int ) optional default: -1 – Scalar value to add context to the nonce.
Returns
string The token.
Source
File name: wordpress/wp-includes/pluggable.php
Lines:
1 to 16 of 16
function wp_create_nonce( $action = -1 ) { $user = wp_get_current_user(); $uid = (int) $user->ID; if ( ! $uid ) { /** This filter is documented in wp-includes/pluggable.php */ $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); } $token = wp_get_session_token( $action ); $i = wp_nonce_tick( $action ); return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); }
Called by
Invoked by
Calls
Call hooks
1 to 1 of 1