Source View: nonce_user_logged_out

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: 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.

Source View

This hook occurs 2 times in this file.

Line Code
1878      if ( ! $uid ) {
1879           /**
1880            * Filters whether the user who generated the nonce is logged out.
1881            *
1882            * @since 3.5.0
1883            *
1884            * @param int    $uid    ID of the nonce-owning user.
1885            * @param string $action The nonce action.
1886            */
1887           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1888      }
1889
1890      if ( empty( $nonce ) ) {
1891           return false;
1892      }
1893
1894      $token = wp_get_session_token();
1895      $i = wp_nonce_tick();
1896
 
Line Code
1933  *
1934  * @param string|int $action Scalar value to add context to the nonce.
1935  * @return string The token.
1936  */
1937 function wp_create_nonce($action = -1) {
1938      $user = wp_get_current_user();
1939      $uid = (int) $user->ID;
1940      if ( ! $uid ) {
1941           /** This filter is documented in wp-includes/pluggable.php */
1942           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1943      }
1944
1945      $token = wp_get_session_token();
1946      $i = wp_nonce_tick();
1947
1948      return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1949 }
1950 endif;
1951