-1

I have referred this question how to start session in wordpress

With this code generated below critical issue.

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

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

// calling session function                                 
register_my_session();                      
?>

enter image description here

Mahesh Thorat
  • 1
  • 4
  • 11
  • 22

1 Answers1

-1

So here I tried below snippet and critical issue resolved.

<?php
function register_my_session(){
  if( ! session_id() ) {
    session_start();
  }
}
if(!is_admin())
{
  add_action('init', 'register_my_session');
}
?>
Mahesh Thorat
  • 1
  • 4
  • 11
  • 22