Search This Blog

Thursday 17 January 2013

Session start in Wordpress

To initiate sessions in Wordpress , Place the following code in theme functions.php file.

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



Of-course you can place the same code in root index.php, wp-config.php files but upgrading the WP to new version will override the changes you made to core files.

No comments:

Post a Comment