Multisite - How sync posts to multi sites

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

My network has:

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

In 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 to Site 1 and Site 2. For the "Post 2" I want that is shared only to Site 2.

All these posts type should be sync.

Is possible to do this?

I thought 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 otherwise updated.

2° Solution In the Main Site I create posts where I specific in which sites the post should be shared, and then in 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 help 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.

Topic sync multisite Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.