not able to redirect after facebook login
<p>I am able to signup with facebook javascript sdk and successfully stored fb login info into WP_user table , but further it is not redirecting to landing page </p>

<p>this is my code  after sucessful fb login </p>

<pre><code>$info1 = array();
    $info1['user_login'] = $info['user_login'];
    $info1['user_password'] =  $info['user_pass'];
    $info1['remember'] = true;

    $user = wp_signon( $info1, false );


        echo json_encode(array('loggedin'=&gt;true, 'message'=&gt;__($login.' successful, redirecting...')));
        wp_redirect(home_url());
</code></pre>

<p>this is the Code on header.php to check if user is logged in </p>

<pre><code> &lt;?php if (is_user_logged_in()) { ?&gt;
 &lt;a href="&lt;?php echo wp_logout_url( home_url() ); ?&gt;"&gt;Logout&lt;/a&gt;
 &lt;?php } else { 

 ?&gt;             
        &lt;a&gt;Login&lt;/a&gt;
        &lt;a&gt;register&lt;/a&gt;

&lt;?php } ?&gt;
</code></pre>

<p>: I also tried one more script for landing Page with login and show welcome </p>

<p>user after login </p>

<pre><code>              &lt;?php

// Enter the app id and secret below
define('YOUR_APP_ID', 'xxxxxxxxxxxx');
define('YOUR_APP_SECRET', 'xxxxxxxxxxx');

function get_facebook_cookie($app_id, $app_secret) {
  $args = array();
  parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
  ksort($args);
  $payload = '';
  foreach ($args as $key =&gt; $value) {
    if ($key != 'sig') {
      $payload .= $key . '=' . $value;
    }
  }
  if (md5($payload . $app_secret) != $args['sig']) {
    return null;
  }
  return $args;
}

$cookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET);
//$user = json_decode(file_get_contents('https://graph.facebook.com/me?access_token='.$cookie['access_token'//])

$user = viacurl('https://graph.facebook.com/me?access_token='.$cookie['access_token']);

function viacurl($location){
    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $location);
    curl_setopt($ch, CURLOPT_HEADER, false);

    $out=curl_exec($ch);

    curl_close($ch);

    return rtrim($out,1);
}

//);

?&gt;

    &lt;div id="fb-root"&gt;&lt;/div&gt;
    &lt;?php 

    print_r($user);

    if ($user-&gt;id) { ?&gt;
      &lt;p&gt;Welcome &lt;?= $user-&gt;name ?&gt;&lt;/p&gt;
    &lt;?php } else { ?&gt;
      &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt;
       &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"&gt;&lt;/script&gt;

      &lt;script&gt;
        FB.init({ 
          appId:&lt;?php print YOUR_APP_ID; ?&gt;, cookie:true, 
          status:true, xfbml:true
        });
      &lt;/script&gt;
      &lt;fb:login-button&gt;Login to Eureka!&lt;/fb:login-button&gt;
    &lt;?php } ?&gt;


  &lt;/div&gt;
</code></pre>

<p>but this also seem obselete</p>

<p>I have seen some posts in which it is said that wordpress take care of session itself . </p>

<p>DO i need to use php sessions or wordpress can do it on its own ?? please suggest if missing something ...</p>