wp_get_session_token()WP 4.0.0

Retrieves the current session token from the logged_in cookie.

No Hooks.

Return

String. Token.

Usage

wp_get_session_token();

Changelog

Since 4.0.0 Introduced.

wp_get_session_token() code WP 6.1.1

function wp_get_session_token() {
	$cookie = wp_parse_auth_cookie( '', 'logged_in' );
	return ! empty( $cookie['token'] ) ? $cookie['token'] : '';
}