wp_get_session_token
Retrieve the current session token from the logged_in cookie.
Description
(string) wp_get_session_token();
Returns (string)
Token.
Usage
if ( !function_exists( 'wp_get_session_token' ) ) { require_once ABSPATH . WPINC . '/user.php'; } // NOTICE! Understand what this does before running. $result = wp_get_session_token();
Defined (1)
The function is defined in the following location(s).
- /wp-includes/user.php
- function wp_get_session_token() {
- $cookie = wp_parse_auth_cookie( '', 'logged_in' );
- return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
- }