WP_Session_Tokens::get_instance( int $user_id )

Retrieves a session token manager instance for a user.

Description Description

This method contains a ‘session_token_manager’ filter, allowing a plugin to swap out the session manager for a subclass of WP_Session_Tokens.

Parameters Parameters


(int) (Required) User whose session to manage.

Top ↑

Return Return

(WP_User_Meta_Session_Tokens) WP_User_Meta_Session_Tokens class instance by default.

Top ↑

Source Source

File: wp-includes/class-wp-session-tokens.php

	final public static function get_instance( $user_id ) {
		 * Filters the session token manager used.
		 * @since 4.0.0
		 * @param string $session Name of class to use as the manager.
		 *                        Default 'WP_User_Meta_Session_Tokens'.
		$manager = apply_filters( 'session_token_manager', 'WP_User_Meta_Session_Tokens' );
		return new $manager( $user_id );

Top ↑

Changelog Changelog

Version Description
4.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.