[wp-hackers] Multisite question

Brian Layman wp-hackers at thecodecave.com
Thu Oct 6 22:04:00 UTC 2011

On 10/6/2011 3:01 PM, Ashish Saini wrote:
> Hi everyone,
> Can I make a single page (lets say *domain.com/api/main*) to render
> different sites of a Multisite setup programmatically?
> Like render output on *domain.com/api/main* as if it was *a.domain.com* or *
> b.domain.com* as per the theme they are running.
> At the moment I am redirecting after figuring out which one needs to be
> used, but I would like to do it on the same page.
> Any ideas how that can be achieved?
> Thanks&  Regards
> Ashish K Saini aka Ashfame
> (Deserve Before You Desire)
> Blog : http://blog.ashfame.com | Twitter : http://twitter.com/ashfame
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
It's hard to give an exact answer without more detials but you can 
output information from another page by calling switch_to_blog() before 
you would send out the information.  So you call switch_to_blog(),  
render the content, and then make sure you switch back at the current 
blog when you are done by calling restore_current_blog();

Leaving a blog switched, can cause very strange behavior.

Brian Layman

More information about the wp-hackers mailing list