My main WordPress installation is on www.example.com.

I have a sub-domain page which is like this: sub.example.com

In the index.php of the sub-domain I use:

define('WP_USE_THEMES', false);
/** Loads the WordPress Environment and Template */
require( '../wp-blog-header.php' );
/** Loads the header for this page */

In header I have:

<?php wp_head(); ?>

And in the footer:

<?php wp_footer(); ?>

The problem I have is that the WordPress Toolbar is not loaded and even though I'm logged in on the main site, and on the sub-domain, this is not recognized.

Is there a way to resolve this issue?

  • Generally speaking, wordpress will work on one domain only. A subdomain is a different domain, and auth cookies wont work there. – yivi Mar 5 '15 at 9:12
  • is_user_logged_in() function returns true though – CiprianD Mar 5 '15 at 9:13
  • There are many missing details here: why are you trying to get to a particular page through a subdomain? If I go to sub.domain.com and to www.domain.com; do I get the same content, generally speaking? On any case, I think that maybe this answer has some clues that would help you. wordpress.stackexchange.com/questions/15335/… – yivi Mar 5 '15 at 9:15
  • I have define('COOKIE_DOMAIN', '.domain.com'); already so probably that's why the users are seen as logged in. – CiprianD Mar 5 '15 at 9:19
  • If you go to sub.domain/wp-admin/ are you able to log in? Again, WP doesn't like very much (and with a good enough reason) you accessing the same content on different domains, so I think that generally speaking, you are setting yourself to disappointment here. – yivi Mar 5 '15 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.