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 |
---|---|
2295 | if ( ! $uid ) { |
2296 | /** |
2297 | * Filters whether the user who generated the nonce is logged out. |
2298 | * |
2299 | * @since 3.5.0 |
2300 | * |
2301 | * @param int $uid ID of the nonce-owning user. |
2302 | * @param string|int $action The nonce action, or -1 if none was provided. |
2303 | */ |
2304 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
2305 | } |
2306 |
|
2307 | if ( empty( $nonce ) ) { |
2308 | return false; |
2309 | } |
2310 |
|
2311 | $token = wp_get_session_token(); |
2312 | $i = wp_nonce_tick( $action ); |
2313 |
|
Line | Code |
2350 | * |
2351 | * @param string|int $action Scalar value to add context to the nonce. |
2352 | * @return string The token. |
2353 | */ |
2354 | function wp_create_nonce( $action = -1 ) { |
2355 | $user = wp_get_current_user(); |
2356 | $uid = (int) $user->ID; |
2357 | if ( ! $uid ) { |
2358 | /** This filter is documented in wp-includes/pluggable.php */ |
2359 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
2360 | } |
2361 |
|
2362 | $token = wp_get_session_token( $action ); |
2363 | $i = wp_nonce_tick( $action ); |
2364 |
|
2365 | return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); |
2366 | } |
2367 | endif; |
2368 |
|