php - Check WordPress login outside currrent domain -
in php website (no wordpress) want check if current visitor , logged in wordpress blog (different folder or domain).
i use code:
define('wp_use_themes', false); require('../wp-blog-header.php'); if(!is_user_logged_in()) { exit('you not have access'); }
it works correctly if php site in path
example.com/site/index.php
but error 500 if use 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 not have access'); }
is possible cross-domain check?
i having similar issue when creating sub-domain display page off site. wasn't getting 500 error page load , user not logged in. reason because wordpress sees sub-domain it's own domain , not try load/access same cookies. ran across post:
https://github.com/dellis23/django-wordpress-auth/issues/6#issuecomment-130070419
you have add cookie_domain , cookiehash wp-config file , set them root domain of wordpress want cookie information from. setting way should allow whole domain able access cookie info.
i don't know why getting 500 error though. maybe it's how trying wp-blog-header.php. don't think can type in actual address "https://www" , need access using "../example.comdomaindirectory/wp-blog-header.php" or "../example.comdomaindirectory/wordpressinstalldirectory/wp-blog-header.php"
hopes helps in endeavor! cheers
Comments
Post a Comment