wp_get_all_sessions() WordPress Function

The wp_get_all_sessions() function is used to retrieve all sessions for the current user. This function is useful for retrieving information about the current user's session, such as their last login time, IP address, and user agent.

wp_get_all_sessions() #

Retrieves a list of sessions for the current user.


Return

(array) Array of sessions.


Top ↑

Source

File: wp-includes/user.php

function wp_get_all_sessions() {
	$manager = WP_Session_Tokens::get_instance( get_current_user_id() );
	return $manager->get_all();
}


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.

Show More
Show More