1

i am new in wordpress i am want to start a session in wordpress i am using this code in theme head to start session

<?php 
add_action('init', 'register_my_session');                                  


// session function                     
function register_my_session(){
    if( !session_id() ) {
        session_start();
    }
}

// calling session function                                 
register_my_session();                      
?>

if this code is ok then where i have to add this code in wordpress to start session

Tom Udding
  • 2,264
  • 3
  • 20
  • 30
  • Possible duplicate of [How to use session\_start in Wordpress?](http://stackoverflow.com/questions/11797351/how-to-use-session-start-in-wordpress) – Masivuye Cokile May 03 '17 at 12:23

1 Answers1

0

You have to place it in your child themes functions.php or create a plugin file for it.

berend
  • 553
  • 2
  • 12