WP_Session_Tokens::destroy_others()publicWP 4.0.0

Destroys all sessions for this user except the one with the given token (presumably the one in use).

Method of the class: WP_Session_Tokens{}

No Hooks.

Return

null. Nothing (null).

Usage

$WP_Session_Tokens = new WP_Session_Tokens();
$WP_Session_Tokens->destroy_others( $token_to_keep );
$token_to_keep(string) (required)
Session token to keep.

Changelog

Since 4.0.0 Introduced.

WP_Session_Tokens::destroy_others() code WP 6.7.2

final public function destroy_others( $token_to_keep ) {
	$verifier = $this->hash_token( $token_to_keep );
	$session  = $this->get_session( $verifier );
	if ( $session ) {
		$this->destroy_other_sessions( $verifier );
	} else {
		$this->destroy_all_sessions();
	}
}