W3cubDocs

/WordPress

WP_Session_Tokens::destroy_others( string $token_to_keep )

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

Parameters

$token_to_keepstringrequired
Session token to keep.

Source

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();
	}
}

Changelog

Version Description
4.0.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_session_tokens/destroy_others