• Resolved hilgo

    (@hilgo)


    I want to preface my question by saying the network is inherited from another dev, I did not set it up so it’s complicating the issue.

    Problem:
    Within the multisite we have a main domain along with five subdomains (let’s say mainsite.xyz, subsite1.xyz, subsite2.xyz etc.).
    In the footer I need to show values from ACF options page, which differ for each subdomain (it’s text). The main domain has that field left out empty = nothing shows.

    However, when I access the subsite1.xyz homepage the value in the footer is empty. I researched further, and the subdomain hompages seem to share the same blog_id and site_id values as the main domain – I echo it out in the footer using this:

    global $wpdb;
    $site_id = $wpdb->siteid; /* tried also get_current_blog_id() */
    $blog_id = $wpdb->blogid;
    
    

    This is the result in dev tools when I am on the subsite1.xyz homepage.

    <footer blog_id="1" site_id="1" id="">

    The blog_id should be”2″ instead.

    This is where it’s interesting: This problem doesn’t persist when I navigate to other pages within the same subdomain (e.g., “/contact/”) — in those cases, the correct and distinct IDs are presented = the ACF field value is showing.

    I checked in the wp_blogs table and can confirm that the IDs are correctly configured there.
    I am a bit lost as to what further can be done about it, looking forward to hearing your ideas.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @hilgo.

    The problem you’re describing sounds like the template being used to render the home page for each subdomain is somehow switching to the main blog to get something, but then not switching back to the subdomain blog.

    I noticed you posted this question about a week ago, so before I start suggesting troubleshooting steps, I wanted to first check whether you’ve been able to figure anything out in the meantime.

    Thread Starter hilgo

    (@hilgo)

    Hi @psykro, thanks for answering – so far I have not been able to come up with a solution.

    There are no templates used on the blogs – just blocks created in ACF, so each homepage has its’ own content.

    Thanks @hilgo

    Have you tried doing a plugin and theme conflict check? So set up a copy of the site locally, disable all plugins and activate one of the default themes across all sites, and see if the problem persists?

    Thread Starter hilgo

    (@hilgo)

    Hello, I wanted to give an update in case anyone goes through the same problem.
    Basically what happened is in one ACF block after using this:

    // Get wordpress blog id
    $blog_id = get_current_blog_id();
    switch_to_blog(1);
    
    

    the previous dev did not finish that block with

    <?php restore_current_blog(); ?>

    Which made it so that the id was outputting correctly on the site up until reaching that block, then it was manually switched to the id=1 and calling the wrong information in the footer.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Blog_id issues on Multisite Network’ is closed to new replies.