Accessing original WordPress blog's DB from sub-blogs in network mode
Posted
by
aendrew
on Stack Overflow
See other posts from Stack Overflow
or by aendrew
Published on 2010-12-22T03:47:18Z
Indexed on
2010/12/22
3:54 UTC
Read the original article
Hit count: 651
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!
© Stack Overflow or respective owner