I’m helping with a university radio station website that runs WordPress and was recently switched over to Network (Multi-site/multi-user) mode by myself. The setup is as such:
-
The parent site (www.stationID.com) runs a bunch of custom-built plugins to construct things like the show schedule calendar, the “Now Playing” widget, podcast list, et cetera.
-
The new network websites (“wiki.stationID.com”, “buddypress.stationID.com” for instance) run the same template as the parent site, but it stops after rendering the first section because the widgets from point 1 grab data from the main site’s database that is not available to sub-blogs.
My question is: how do I get data from the main site’s tables on the sub-domain sub-blogs? A related question is: how do I set the $wpdb->prefix
to be the same as the parent site on the child websites without it negatively effecting how the child website pulls data from its own database?
Any help would be awesome, thanks!
Wrap that data in a switch_to_blog function. Yes, it’s deprecated but there’s no replacement at the moment. 🙂
do stuff from main blog