Let’s assume that you have a WordPress multisite network installed and some (or all) of the sites of the network are WooCommerce stores.
The thing is that sometimes you may need to sync WooCommerce products between the sites of your multisite network.
Because we are talking about WordPress Multisite we are not going to work with REST API, the tutorial will be all around
switch_to_blog() function and CRUD layers.
Let’s assume, that you’re currently working on Site A and you need to get and display a post (or page or a custom post type – doesn’t matter) from Site B of your Multisite network.
How to do that?
Recently I’ve been working with this functionality in one of my plugins and now I decided to share it with you.
But I always want my tutorials to be more practical, so check what we are going to create:
The whole tutorial consists of two parts – in the first one I will show you a ready to use function that allows to move media from one site of a multisite network to another, in the second – we will create a custom bulk action for media files.
There are actually two ways of organising shared content between sites in Multisite Network:
This tutorial is how to add settings pages to Network Admin with WordPress Multisite installed. I have a couple amazing tutorial on my blog where you can learn how to create options pages with Settings API or how to add site-specific settings in Network Admin > All Sites.
That’s how the settings page we are going to create here looks like: