Reputation: 1646
I have a main website and 3 child websites using wordpress multisite feature. Currently I'm facing problem in sharing data between child sites and main site. The child site can't access wp_post table, it take data from its own post table. I tried broadcast plugin to share data. But that plugin copy post data from main site to child site. My requirement is, the child and main website should use the main wp_post table to add posts, so that when a child site changes a post assigned to it from the main site, the change should affect in both child and main sites. The child website can access only the post allowed by super user (Network admin ). Is it possible in wordpress? How can we change global $post in WP ? i am using woocommerce so i want list some products in particular child site How can we do that ?
Upvotes: 0
Views: 221
Reputation: 11808
I thought on your requirement and searched a lot through the wordpress core.
I dont think, it is possible in wordpress to allow child site to use the database of main site.
Reason being, there are no hook or filter provided to change $wpdb variable or the table prefix on runtime.
Thus, for you the solution is to make use of Broadcast MU plugin.
https://wordpress.org/plugins/broadcast-mu/
This plugin copies the post from main site to required child site. Also when user from main site changes the post, the same is changed in child site.
Your requirement is little different, you want it other way round.
You will have to customize the plugin so that when child site changes the post, it should be updated on main site.
Upvotes: 1