WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use FaceBook JS SDK to check whether the user has permission to log in to my site or not. If user has permission I log him into the WP site.

It is possible to check with JS whether the user already logged in or not? Possible to check existance of wordpress_logged_in_ cookie, and how?

I am trying with this code, but doesn't work:

if (document.cookie.search(/^wordpress_logged_in_\w*/) >= 0) {
  // Cookei exsist.


share|improve this question

Just use wp_localize_script() and is_user_logged_in().

        'ajaxurl' => admin_url( 'admin-ajax.php' ),
        'logged_in' => is_user_logged_in()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.