is_user_logged_in fails if WordPress address (URL) not equal Site address (URL)
-
Ok, this is a little obscure and I’d appreciate any help.
I’m creating a blog in which some material is private and people need to login to get to. At present the blog is hosted at:
https://www.thehostingdomin.org/blogdirectory
and on the General Settings page WordPress address (URL) == Site address (URL). Everything works fine. The blog works, what’s public is visible, what’s not is hidden until a user logins. Everything is as it should be.Now the blog will be accessed via:
https://www.therealdomain.orgNow to make it work I have:
a) set up my hoster to point https://www.therealdomain.org to https://www.thehostingdomain.org/blogdirectory
b) changed the Site address (URL) to “https://www.therealdomain.org
c) updated the .htaccess file in https://www.thehostingdomain.org/blogdirectory according to what the permalinks says it should be.Everything works fine too. When you’re browsing the blog, all links have https://www.therealdomain.org instead of https://www.thehostingdomain.org/blogdirectory so visitors don’t know about https://www.thehostingdomain.org.
The problem comes when you login to view the private content. I can login either at:
https://www.thehostingdomain.org/blogdirectory/wp-login.php
or
https://www.therealdomain.org/wp-login.phpEither way after logging when I start browsing (i.e. browsing https://www.therealdomain.org) wordprss doesn’t seem to know I’ve logged in. I’ve tracked it down to the function is_user_logged_in — it thinks I’m not logged in.
The odd thing is that while I browse using https://www.therealdomain.org, all admin work is done via https://www.thehostingdomain.org/blogdirectory and the admin side knows I’m logged in and works fine.
Any suggestions on how to deal with this would be greatly appreciated as this is a big problem for me.
Thanks
- The topic ‘is_user_logged_in fails if WordPress address (URL) not equal Site address (URL)’ is closed to new replies.