Filter hook 'nonce_user_logged_out'

in WP Core File wp-includes/pluggable.php at line 2437

View Source

nonce_user_logged_out

Filter Hook
Description
Creates a cryptographic token tied to a specific action, user, user session, and window of time.

Hook Information

File Location wp-includes/pluggable.php View on GitHub
Hook Type Filter
Line Number 2437

Hook Parameters

Type Name Description
string|int $action Scalar value to add context to the nonce.

Usage Examples

Basic Usage
<?php
// Hook into nonce_user_logged_out
add_filter('nonce_user_logged_out', 'my_custom_filter', 10, 1);

function my_custom_filter($action) {
    // Your custom filtering logic here
    return $action;
}

Source Code Context

wp-includes/pluggable.php:2437 - How this hook is used in WordPress core
<?php
2432  	function wp_create_nonce( $action = -1 ) {
2433  		$user = wp_get_current_user();
2434  		$uid  = (int) $user->ID;
2435  		if ( ! $uid ) {
2436  			/** This filter is documented in wp-includes/pluggable.php */
2437  			$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
2438  		}
2439  
2440  		$token = wp_get_session_token();
2441  		$i     = wp_nonce_tick( $action );
2442  

PHP Documentation

<?php
/**
	 * Creates a cryptographic token tied to a specific action, user, user session,
	 * and window of time.
	 *
	 * @since 2.0.3
	 * @since 4.0.0 Session tokens were integrated with nonce creation.
	 *
	 * @param string|int $action Scalar value to add context to the nonce.
	 * @return string The token.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/pluggable.php
Related Hooks

Related hooks will be displayed here in future updates.