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 |
|---|---|
| 2472 | if ( ! $uid ) { |
| 2473 | /** |
| 2474 | * Filters whether the user who generated the nonce is logged out. |
| 2475 | * |
| 2476 | * @since 3.5.0 |
| 2477 | * |
| 2478 | * @param int $uid ID of the nonce-owning user. |
| 2479 | * @param string|int $action The nonce action, or -1 if none was provided. |
| 2480 | */ |
| 2481 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 2482 | } |
| 2483 | |
| 2484 | if ( empty( $nonce ) ) { |
| 2485 | return false; |
| 2486 | } |
| 2487 | |
| 2488 | $token = wp_get_session_token(); |
| 2489 | $i = wp_nonce_tick( $action ); |
| 2490 | |
| Line | Code |
| 2527 | * |
| 2528 | * @param string|int $action Scalar value to add context to the nonce. |
| 2529 | * @return string The token. |
| 2530 | */ |
| 2531 | function wp_create_nonce( $action = -1 ) { |
| 2532 | $user = wp_get_current_user(); |
| 2533 | $uid = (int) $user->ID; |
| 2534 | if ( ! $uid ) { |
| 2535 | /** This filter is documented in wp-includes/pluggable.php */ |
| 2536 | $uid = apply_filters( 'nonce_user_logged_out', $uid, $action ); |
| 2537 | } |
| 2538 | |
| 2539 | $token = wp_get_session_token(); |
| 2540 | $i = wp_nonce_tick( $action ); |
| 2541 | |
| 2542 | return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 ); |
| 2543 | } |
| 2544 | endif; |
| 2545 | |