WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WP_Session_Tokens::create() public WP 4.0.0

Generates a session token and attaches session information to it.

A session token is a long, random string. It is used in a cookie to link that cookie to an expiration time and to ensure the cookie becomes invalidated when the user logs out.

This function generates a token and stores it with the associated expiration time (and potentially other session information via the 'attach_session_information' filter).

{} Это метод класса: WP_Session_Tokens{}

Хуки из метода

Строку. Session token.


$WP_Session_Tokens = new WP_Session_Tokens();
$WP_Session_Tokens->create( $expiration );
$expiration(число) (обязательный)
Session expiration timestamp.

Список изменений

С версии 4.0.0 Введена.

Код WP_Session_Tokens::create() WP 5.7.1

final public function create( $expiration ) {
	 * Filters the information attached to the newly created session.
	 * Can be used to attach further information to a session.
	 * @since 4.0.0
	 * @param array $session Array of extra data.
	 * @param int   $user_id User ID.
	$session               = apply_filters( 'attach_session_information', array(), $this->user_id );
	$session['expiration'] = $expiration;

	// IP address.
	if ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
		$session['ip'] = $_SERVER['REMOTE_ADDR'];

	// User-agent.
	if ( ! empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
		$session['ua'] = wp_unslash( $_SERVER['HTTP_USER_AGENT'] );

	// Timestamp.
	$session['login'] = time();

	$token = wp_generate_password( 43, false, false );

	$this->update( $token, $session );

	return $token;