@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?
- How to use same email for multiple users
- How do I remove/delete an old super admin user?
- How will self-hosted WordPress work with Google Page Speed Service?
- What is the best way to load the WP environment in a subdomain of my multisite WordPress install?
- Benefits or Problems for using Sub-Directory vs Sub-Domain install of WP Network
- What methods should be used to fend off splogs in a multiuser install? [closed]
- WordPress 3 Multisite using subdomains.- DNS on Cpanel question
- wp_get_attachment_image_src multisite issue
- Transfer Subdomain site to Multisite setup
- WP REST API – Multisite – get posts from all sites
- How to Login Once to an Entire WP Multisite Network
- NGINX Multisite Rewrite rules
- What is the best way to setup wordpress development environment for freelancers with version control?
- Get source from the_post_thumbnail
- Subsites in Multisite installation throwing 404 error on wp-admin in IIS 7
- Creating a better multi-site search experience
- BackPress – which libraries i need to load to work with Multisite?
- How do I maintain static directories on multisite subdomains?
- WP-CLI can’t list posts
- Woocommerce and different checkout field for different countries
- Why is multisite rest API keep giving me results for root site only?
- How to stay logged in on a multisite with different domains?
- Custom Post types and Custom fields in Multisite
- Login on Multiple Sub-Domains without Multisite
- Prevent images on self-hosted WordPress from being served from WordPress.com
- Use another author.php if different multisite subsite?
- Subsite with different template, and content
- What is best forum script available to integrate with wordpress?
- WordPress multisite fails to create a new site in the network
- Changing path for media upload folder in wordpress multisite
- Making 2 WordPress sites mutually searchable and more
- Unable to apply theme to WordPress Network Site install
- Setup a multisite to a running website
- Use WordPress MultiSite (WPMS) with a remote database for each created site
- Viewing / Editing A Multisite website after domain has expired
- Redirect old uploads after moving to multisite
- How to set up wordpress domain mapping on MAMP Pro
- How to show different sub sites based on Member’s user name In word press?
- Debugging unserialize errors [closed]
- new site admin not able to browse categories in wordpress multisite
- Best architecture for multiple websites
- Admin permission for creating blogs in multisite
- Multisite / Network – Stable?
- Eliminate MultiSite Network Splogs
- Copy user role on multisite so the user can access subsites with same role
- WordPress MU wp_posts table
- WordPress Multisite (sub-directory based), change subsite URL
- 403 forbidden when changing settings on WP Multisite non-main sites
- Multisite 404 for pages in includes subdirectory
- Multisite infinite redirect loop
- Customize or avoid new admin email address notification
- After setting up multisite on localhost, requests to localhost redirect to production domain
- WordPress Multisite Dilemma!
- Certain lines added to our wp-config.php file are being removed, every day
- WordPress multisite installation subdomains not working properly
- How to use the same users table on multiple wordpress sites
- My Sites link in multisite is incorrect
- Multisite subdirecty added inside URL to uploaded files
- local wordpress multisite not working on AWS development server “error establishing database connection”
- WP Multi Site – configure Sub domain pointing to parent sub directory
- Is it better to embed widgets on posts or pages?
- WordPress Upgrade – API files returning 404 on Multisite
- Activate User account for Sub Site broken
- Migration of Multisite WordPress site from http to https
- WordPress Multisite – Auto enable theme
- Network redirect issues
- Redirecting two Multisite domains to Single site on different host
- WordPress Multisite subdomains and sharing the same upload folder
- REST or Alternative Method for New User && New Site && Assign User to New Site as Admin?
- Problem in adding new site on WP multisite
- How to create child/sub user under parent user
- Show all posts on a twentythirteen multisite
- Network created blogs URL
- Make different sites on multisite reference same script
- Problem with paging on Multisite
- WordPress and multisites, the rigth choice?
- Best Way to Setup a Network of WP Sites?
- Trying to create site-wide Active Directory sync with Multisite
- Run WordPress multisite from secondary volume on AWS EC2