WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
| Line | Code |
|---|---|
| 2124 | if ( ! $uid ) { |
| 2125 | /** |
| 2126 | * Filters whether the user who generated the nonce is logged out. |
| 2127 | * |
| 2128 | * @since 3.5.0 |
| 2129 | * |
| 2130 | * @param int $uid ID of the nonce-owning user. |
| 2131 | * @param string $action The nonce action. |
| 2132 | */ |
| 2133 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 2134 | } |
| 2135 | |
| 2136 | if ( empty( $nonce ) ) { |
| 2137 | return false; |
| 2138 | } |
| 2139 | |
| 2140 | $token = wp_get_session_token(); |
| 2141 | $i = wp_nonce_tick(); |
| 2142 | |
| Line | Code |
| 2179 | * |
| 2180 | * @param string|int $action Scalar value to add context to the nonce. |
| 2181 | * @return string The token. |
| 2182 | */ |
| 2183 | function wp_create_nonce( $action = -1 ) { |
| 2184 | $user = wp_get_current_user(); |
| 2185 | $uid = (int) $user->ID; |
| 2186 | if ( ! $uid ) { |
| 2187 | /** This filter is documented in wp-includes/pluggable.php */ |
| 2188 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 2189 | } |
| 2190 | |
| 2191 | $token = wp_get_session_token(); |
| 2192 | $i = wp_nonce_tick(); |
| 2193 | |
| 2194 | return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); |
| 2195 | } |
| 2196 | endif; |
| 2197 | |