wp_get_all_sessions

Retrieve a list of sessions for the current user.

Description

(array) wp_get_all_sessions(); 

Returns (array)

Array of sessions.


Usage

  1. if ( !function_exists( 'wp_get_all_sessions' ) ) { 
  2. require_once ABSPATH . WPINC . '/user.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_get_all_sessions(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/user.php  
  1. function wp_get_all_sessions() { 
  2. $manager = WP_Session_Tokens::get_instance( get_current_user_id() ); 
  3. return $manager->get_all();