@Pat J: thank you for your answer. As an old developer as i am, that was one of the first reflex i had, i disabled plugins, and even custom functions. Nothing ever helped. I forgot to mention that out.
But i found the solution, and that’s quite stupid, read that:
$blog_id is somehow used in the loop (or generally in the template) so you should never assign this variable. $blog_id is a reserved variable in template! Now i’ll remember 😉
What happened is that, by changing $blog_id‘s value, subsequent helper function calls were working on the wrong blog, thus using wrong upload folder for example.
It also addresses my first issue: network_site_url($sub_blog_id) gives me the URL of a foreign blog, as i needed. The $blog_id bug was affecting this behavior too.
Hope this helps!
Related Posts:
- How can I trust switch_to_blog()?
- Sharing Dynamic Sidebars across Multisite Blogs
- latest 5 posts using switch_to_blog loop
- Switch_to_blog() outside wordpress
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- Upload images from one site to another in Multisite
- What is the way to share data between sites in a multisite
- get post id by $content (so by post content)
- Register submenu on network menu from the subsite
- Include Site 1 Posts in Query for Sub Sites
- Sort posts according to date
- Multisite switch to blog
- Best Practise: Linking to WPMU sites from other sites
- Trouble with SQL SELECT inside switch_to_blog()
- Display posts from one network site on another
- Get variable from previous blog while using switch_to_blog
- switch_to_blog($blog_id); still writing to main blog
- fatal Error undefined function switch_to_blog()
- How to get all pages on specific blog after switch_to_blog?
- Do “switch_to_blog()” and “restore_current_blog()” re-run the filters?
- Get the excerpt by page ID from another blog in a wordpress multisite?
- Memory growth with new additions to WordPress Multisite
- metaboxes disappear on saved pages
- How to show only blog-domain instead of the whole permalink in the loop
- Multisite installation on an existing single installation
- Multisite Sub domains not working
- How Can I Change The Name Of My Subdomain in WordPress Multisite
- Display site description instead of site name
- User registration on two sites in same multisite
- Multiple subsites in a single wordpress installation
- How many databases do I need?
- How to sync roles across Multisite?
- WordPress multi-site: How do I create the home page, the root URL?
- Multiple Websites that share some content types and not others
- Solving a get_user_meta() problem in Multisite
- Multisite Subdirectory Site Dashboard redirect loop
- WordPress Multisites or Multiple WP Single sites?
- Is it possible to query posts with tax queries after multisite switch_to_blog() function?
- In Multisite the users profile picture keeps disappearing for “the other site”
- How to use the sunrise.php script for Multisite network domain mapping?
- Is it possible to disable html code error auto fixing feature by wordpress 4.9.1?
- LimitInternalRecursion error
- How to pull data from child installation to parent theme
- get_term_by works but get_terms doesn’t?
- Should I use Multi Site to achieve different designs for different sections?
- User registration is currently not allowed
- $_SERVER[‘SERVER_NAME’] in WP_SITEURL
- WPMU on MySQL limited to 1GB of space?
- Two installs conflicting – Pages redirecting
- Website not listed under Sites (in a Network environment)
- WordPress Multisite Permalinks on mapped domain = server 404 error
- Sites network with sub-folders
- Set my own password when registering a multisite user or site
- Efficient way to fetch all archived WPMS blogs
- Give users acces to admin a single post or set up WP network?
- WP-Cli Error When Mapping Multisite Subdomain
- WordPress Multisite for multi-language
- get_site_option / update_site_option – the main site and sub sites do not share the same storage
- WordPress keeps deleting user account for multisite after loggin out i need your help please?
- Change main site / network admin site?
- Serve theme and plugins assets from correct domain on multi-domain multisite
- Can I use the main Multisite as a backend only?
- Number of total comment does not tally with the number of comment?
- WP Multisite Sub-Domain Error
- Downloading customized theme from wordpress
- Multisite different domains mapping error on GGS
- Subsites in Multisite throw 404 in wp-admin
- WordPress theme to support single website but with 3 sections for 3 languages
- WordPress multisite condition for certain blog_id’s
- the menu of the network does not display my second website
- Multisite – site user limited only for this site
- Update siteurl and home in multisite subsites to https
- WordPress multi-domain with multiple sites with multiple languages
- WordPress Multisite wp-admin/ redirect loop but adding index.php works fine
- Domain level problem for multisite?
- Can WP multisite manage multiple ccTLDs
- Should i use multisite for my business?
- WordPress Network with SSL for multiple domains
- Nginx rules for subdomain multisite install (Bedrock)
- Redirect www.mainsite.com/subsite/wp-login to www.mainsite.com/wp-login
- WP Admin Panel for Multi-site install not loading JavaScript for one Subdomain
- WordPress multisite not working
- Activation of new Registered site fails on multisite
- WordPress Multisite redirect loop
- multisite detect subsite blog number
- How to Create WPMu New User?
- New multisite redirects to main site
- Can I just copy and duplicate a WordPress installation?
- cannot access subsites in wordpress multisite
- WordPress Multisite – is this possible?
- WordPress on Nginx – Missing admin/toolbar
- Change identical page for every site in multisite
- 4th Network Site Database Errors?
- WordPress MultiSite Link Cloaking/Redirect Solution?
- How to disable admin access on new site registration for user in Multisite?
- Maximum Execution Time Exceeded Error while creating New Site in Multisite, Increasing Time Not working
- Moved WP Multisite, cannot access sites
- SuperAdmin Access to a Subsite fails
- Best way to set up multiple urls for the same WordPress site?
- WordPress Translation not working for my theme