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
1989      if ( ! $uid ) {
1990           /**
1991            * Filters whether the user who generated the nonce is logged out.
1992            *
1993            * @since 3.5.0
1994            *
1995            * @param int    $uid    ID of the nonce-owning user.
1996            * @param string $action The nonce action.
1997            */
1998           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1999      }
2000
2001      if ( empty( $nonce ) ) {
2002           return false;
2003      }
2004
2005      $token = wp_get_session_token();
2006      $i = wp_nonce_tick();
2007
 
Line Code
2044  *
2045  * @param string|int $action Scalar value to add context to the nonce.
2046  * @return string The token.
2047  */
2048 function wp_create_nonce($action = -1) {
2049      $user = wp_get_current_user();
2050      $uid = (int) $user->ID;
2051      if ( ! $uid ) {
2052           /** This filter is documented in wp-includes/pluggable.php */
2053           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
2054      }
2055
2056      $token = wp_get_session_token();
2057      $i = wp_nonce_tick();
2058
2059      return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
2060 }
2061 endif;
2062