0

I have a network with multi-site and I need that there's a "main" site where I can add posts, taxonomies, and pages (and also translations about them) and I want the possibility to share the different post types to different sites along my network. For example:

My network has:

  • Main Site
  • Site 1
  • Site 2
  • Site 3

On the Main Site I have these posts:

  • Post 1
  • Post 2
  • Post 3

Each post could have a lot of data related (taxonomies, custom fields, translations, etc.)

So for the "Post 1" I want that is shared with Site 1 and Site 2. For the "Post 2" I want that is shared only to Site 2.

All these posts type should be synced.

Is possible to do this?

I thought of two solutions, but I have no idea to make them.

1° Solution: Using the Main Site to create posts and then sync them to other sites where I want to share my post. So If the post doesn't exist, it should be created or otherwise updated.

2° Solution In the Main Site, I create posts where I specify in which sites the post should be shared, and then on each site, I pull out the related posts from the Main Site.

What is the best solution to manage this scenario? There are other solutions? There is a WP function that helps me to do it? I think that Multisite in this scenario is ok for manage in easy way plugins and themes, but I need that some things are shared across the sites of my network.

1 Answer 1

1

If you need to share them automatically, you can use save_post action hook and switch_to_blog and get_post() + wp_insert_post functions.

I can suggest this tutorial. I think there is no reason to copy all the code from there to here.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.