WordPress session management

It’s a very bad idea to modify WP Core files for the ability to use sessions. The best way I’ve found is to call the session_start() from init action hook.

function kana_init_session() {
  session_start();
}

add_action('init', 'kana_init_session', 1);

You can place it in functions.php file of your theme.

Detailed article can be found here: http://www.kanasolution.com/2011/01/session-variable-in-wordpress/

Leave a Comment