PHP session
-
Wp and the hoster swear at the php session. It is clear that wp does not use sessions.
Wp error: The PHP session was created by calling the session_start () function. This prevents REST API and loopback requests from working. The session must be closed with the session_write_close () function before making any HTTP requests
I use are child theme. If i add this cod in function.php my child theme:
add_action('init', 'start_session', 1); function start_session() { if(!session_id()) { session_start(); } add_action(‘wp_logout’, ‘end_session’); add_action(‘wp_login’, ‘end_session’); add_action(‘end_session_action’, ‘end_session’); function end_session() { session_destroy (); }
This action don’t work. I think becase need to add a global variable yes?
This is.
$foo = ‘Foo Data’;
$_SESSION[‘foo’] = $foo;But i dont now when file i need rhis global variable.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP session’ is closed to new replies.