Domain Mapping apparently causing problems with switch_to_blog

Hi,
I'm having some problems using the switch_to_blog function when a domain is mapped with your domain mapping plugin.

I've installed a small bit of code that does a check with the switch to blog function.

Here's the result on a non-mapped website:

$current_site (Main Blog) Details
Main Blog ID ($current_site->blog_id) : 1
Main Blog Name ($current_site->site_name): langhe.net

Current Site Details
Current Site ID : 130
Current Site Name : Shop Langhe

After switching to main blog using switch_to_blog(1);
Current Site ID : 1
Current Site Name : Z>>>Langhe.net<<<Z

After restoring current blog using restore_current_blog();
Current Site ID : 130
Current Site Name : Shop Langhe

And here's a result of a domain mapped website

This snippet tests your site for MultiSite and makes sure blog switching works.

$current_site (Main Blog) Details
Main Blog ID ($current_site->blog_id) :
Main Blog Name ($current_site->site_name): langhe.net

Current Site Details
Current Site ID : 70
Current Site Name : Ambiente & Cultura

After switching to main blog using switch_to_blog();
Current Site ID : 70
Current Site Name : Ambiente & Cultura

After restoring current blog using restore_current_blog();
Current Site ID : 70
Current Site Name : Ambiente & Cultura

Did anybody experience something similar?

thanks!

  • Jack Kitterhing
    • Code Norris

    Hi there @chickenrun

    I hope you are well today and thanks for your question.

    I haven't seen any reports of the switch_to_blog() having problems with domain mapping, does the site using something like Pro Sites? If so does switch_to_blog() function correctly with that?

    Thank you!

    Kind Regards
    Jack.

  • chickenrun
    • Site Builder, Child of Zeus

    Hi Jack.

    I'm not using ProSite.
    Anyway, the problem was just when I was trying to switch to the main blog (worked when I was switching to sublogs).

    I found that the issue was caused by the fact that I was using a www. domain on the main site (it has always caused problems, one reason more to switch to the non www. version).

    Best

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.