We are setting up a second site on a multisite installation, and have noticed on the new site, that the 'lost password' and subsequent reset password links are pointing to the original site.

In the second site, I have added a plugin which just does this.

$current_network = get_network();
return print_r($current_network, true);

This does return the 1st network details - but maybe it always does.

The network_site_url function has a check for is_multisite - which as far as I can see, this is what it needs to do - grabbing the site_url would work, but it skips past this and does the get_network() call.

if ( ! is_multisite() ) {
    return site_url( $path, $scheme );

The details in the Network Admin/Sites are correct for both sites.

Is there anywhere I need to set something?

  • "This does return the 1st network details" - that sounds wrong to me, and I'm surprised the admin site works and this doesn't (?). Can you debug ms_load_current_site_and_network in wp-includes/ms-load.php and the code that calls it in ms-settings.php? Do you have a sunrise.php - is that (or wp-config?) setting $current_site or any SITE constant? Or any mu-plugins that might interfere with this, e.g. hooking get_network ? – Rup Mar 30 at 16:19
  • And to be clear this is a second network, i.e. you have two completely different multisites with 1+ sites each and distinct user tables per network? It's not two sites in one network that share one user table? (i.e. when you say "The details in the Network Admin/Sites are correct for both sites" you meant "both networks" ?) – Rup Mar 30 at 16:21
  • Sorry - my bad wording. It is one multisite network, with 2 sites. The 2nd site's lost password is pointing to the first site.I have for now added a filters (lostpassword_url and retrieve_password_message) to change the paths. I will edit the question now. – StripyTiger Mar 30 at 16:33
  • 1
    Yes, that's normal then, and that sounds like the way to do it: this question links to this gist with a plugin to hook lostpassword_url etc. – Rup Mar 30 at 16:39

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.