0

Im trying to create a new session beside wordpress session and set a property after wordpress login

function login_function() {
        global $current_user;
        $email = (string) $current_user->user_email;
        $xxx = session_name("xxx");
        session_set_cookie_params(0, '/', '.اینستا.com');
        session_start();
        $_SESSION['email'] = $email;
        echo '<script language="javascript">';
        echo 'alert('.$_SESSION['email'].')';
        echo '</script>';
}


add_action('wp_login', 'login_function');

it shows empty and cant redirect successfully

UPDATE

echo 'alert('.$email.')';

happen the same thing, alert empty and fail to redirect successfully

zEn feeLo
  • 1,877
  • 4
  • 25
  • 45
  • Are you sure there was no `session_start` somewhere before? – Sindhara Mar 17 '19 at 07:41
  • WordPress session start with login , Im trying to create another new session which will be available through whole domain and sub domain look please https://stackoverflow.com/questions/1064243/php-sessions-across-sub-domains – zEn feeLo Mar 17 '19 at 07:49
  • you can't create two sessions at the same time as far as I know. You should try to disable the wordpress session – Sindhara Mar 17 '19 at 08:17

0 Answers0