Check WordPress login outside currrent domain

In a PHP website (no WordPress) I want to check if current visitor is already and previously logged in another WordPress blog (different folder or domain).

I use this code:

define('WP_USE_THEMES', false);
require('../wp-blog-header.php');
if(!is_user_logged_in())
{
exit('You do not have access');
}

It works correctly if PHP site is in this path

example.com/site/index.php

but I get Error 500 if I use it in

SUBDOMAIN.example.com/index.php

define('WP_USE_THEMES', false);
require('httpS://www.example.com/wp-blog-header.php');
if(!is_user_logged_in())
{
exit('You do not have access');
}

Is it possible to do a cross-domain check?

Read more here: Check WordPress login outside currrent domain

Leave a Reply

Your email address will not be published. Required fields are marked *