Wordpress $_SESSION not working even after adding add_action('init, '...',1) Wordpress $_SESSION not working even after adding add_action('init, '...',1) wordpress wordpress

Wordpress $_SESSION not working even after adding add_action('init, '...',1)


Place this code in your functions.php file

function sess_start() {    if (!session_id())    session_start();}add_action('init','sess_start');


See this answer for a discussion of using $_SESSION with WordPress. In short, WordPress removes session variables if register_globals is defined.

The comments on the question itself point to this answer on the WordPress stackexchange, which discusses a plugin that may help you.