Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7995981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:34:55+00:00 2026-06-04T14:34:55+00:00

I am using facebook-php-sdk ( github ) for facebook login on my localhost page,

  • 0

I am using facebook-php-sdk (github) for facebook login on my localhost page, when i logout, the page is not redirecting..

And the same page i can see the my profile information in arrays, even after i pressed logout then data should be empty on page but its display all information.

i have used below code, but its not redirect

$logoutUrl = $facebook->getLogoutUrl(array('next' => 'http://google.com'));

<?php if ($user): ?>
    <a href="<?php echo $logoutUrl; ?>">Logout</a>
<?php else: ?>
    <div>
    Login using OAuth 2.0 handled by the PHP SDK:
    <a href="<?php echo $loginUrl; ?>">Login with Facebook</a>
    </div>
<?php endif ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:34:57+00:00Added an answer on June 4, 2026 at 2:34 pm

    The only way to have a succesful logaut using the PHP SDK was this for me: redirect the logout button to a function and do the following

    private function do_facebook_logout() {
        // Get an instance of the Facebook class
        $facebook = $this->facebook_instance_factory();
        // Destroy the session so that no Facebook data is held
        $facebook->destroySession();
        // Get the logout URL from the Facebook Class
        $logout = $facebook->getLogoutUrl();
        // Redirect the user to the logout url, facebook will redirect him to our page
        wp_redirect( $logout );
    }
    

    i actually redirected the user after unsetting facebook session. Remember that if you are setting an acces token programmatically in the instyance of the Facebook class you must invalidate the token too

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok so I'm using Facebook PHP SDK currently I'm rendering the login/logout buttons as
I am using the PHP library for the Graph API ( http://github.com/facebook/php-sdk ) but
Using the Facebook Graph API and the PHP SDK, I know that I can
Using Facebook's PHP SDK, I was able to get Facebook login working pretty quickly
I am using a modified version php-sdk version 3.0.0 sample code at github.com/facebook within
Has anyone figured out how to delete an event using the Facebook php-sdk? Not
So I am using the facebook-php-sdk and I have created a page tab On
I'm using Facebook PHP SDK v2.1.2 and JS SDK on my page. I've put
I'm making a website using Facebook Connect php sdk,when i login using face book
I'm using the Facebook PHP SDK to register new users with data pulled from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.