Why wordpress 5.5 automaticlly clear data in session

Question

Good evening,

I wrote a plugin. In this plugin I need to pass variable between two pages. For this operation I used $_SESSION. When I use this code:

if (!session_id()) {
        session_start();
    }

$_SESSION['test'] = 'abc';

The value save in $_SESSION[‘test’]. Then I want to check it is available after refresh.

if (!session_id()) {
            session_start();
        }

var_dump($_SESSION['test']);

And I get NULL. This operation work in localhost. In php.ini I have session enabled. Thanks for any help.

Kind regards

0
Przemyslaw Suszek 2 years 2020-10-21T17:10:39-05:00 0 Answers 10 views 0

Leave an answer

Browse
Browse