determine_current_user filter-hookWP 3.9.0

Filters the current user.

The default filters use this to determine the current user from the request's cookies, if available.

Returning a value of false will effectively short-circuit setting the current user.

Usage

add_filter( 'determine_current_user', 'wp_kama_determine_current_user_filter' );

/**
 * Function for `determine_current_user` filter-hook.
 * 
 * @param int|false $user_id User ID if one has been determined, false otherwise.
 *
 * @return int|false
 */
function wp_kama_determine_current_user_filter( $user_id ){

	// filter...
	return $user_id;
}
$user_id(int|false)
User ID if one has been determined, false otherwise.

Changelog

Since 3.9.0 Introduced.

Where the hook is called

_wp_get_current_user()
determine_current_user
wp-includes/user.php 3632
$user_id = apply_filters( 'determine_current_user', false );

Where the hook is used in WordPress

wp-includes/default-filters.php 487
add_filter( 'determine_current_user', 'wp_validate_auth_cookie' );
wp-includes/default-filters.php 488
add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
wp-includes/default-filters.php 489
add_filter( 'determine_current_user', 'wp_validate_application_password', 20 );