Wordpress session variable not working

后端 未结 1 2013
梦谈多话
梦谈多话 2020-12-18 07:46

I have an issue with a WordPress session. I have a file \'test.php\' that is used post a variable to a WordPress site. It has the condition: \"if the session variable is set

1条回答
  •  抹茶落季
    2020-12-18 08:13

    Just hook a function on "init" in your functions.php like this :

    function ur_theme_start_session()
    {
        if (!session_id())
            session_start();
    }
    add_action("init", "ur_theme_start_session", 1);
    

    Then u can use your session variables.

    I hope that help u.

    0 讨论(0)
提交回复
热议问题