WP_Session_Tokens::get_instance() WordPress Method

This is the WP_Session_Tokens class. It provides an API for managing user sessions. This includes creating and destroying sessions, as well as retrieving information about them. The class is used by the wp_session_token_get_instance() function.

WP_Session_Tokens::get_instance( int $user_id ) #

Retrieves a session manager instance for a user.


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.


Top ↑

Parameters

$user_id

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


Top ↑

Return

(WP_Session_Tokens) The session object, which is by default an instance of the WP_User_Meta_Session_Tokens class.


Top ↑

Source

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

	final public static function get_instance( $user_id ) {
		/**
		 * Filters the class name for the session token manager.
		 *
		 * @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
VersionDescription
4.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.