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

Read more here: how to start session in wordpress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: