WordPress Multisite — is a way of WordPress configuration which allows you to create the unlimited amount of sites within a single installation. These websites are going to share the same database but can have separate subdomains or even domains.

Using Global Product Images in WooCommerce Multisite

In this tutorial we’re going to talk about how to make WooCommerce display images from the main store (and we decide which store is going to be the main). The next question that you may have is how did that happen that you have the same products across different stores of your multisite network. And the reasons can be pretty much different, for example:

  • Probably you’re using WooCommerce Multisite as a multilingual solution, so basically you have the same stores with the same products but in different languages.
  • Or maybe you’re using my multisite crossposting plugin to publish your products to the other stores of your network.

And the whole idea of this tutorial is to prevent the product images from being duplicated to every sub-store uploads folders like /uploads/sites/2, /uploads/sites/3 and so on.

How to Create a Language Redirect in Multisite

Recently I got a request from my client and what she was needed is to automatically redirect users to a language-specific store within the WordPress multisite network depending on a customer IP address.

For example:

  • – redirect customers here if they have a norwegian IP address,
  • – redirect customers here if they have a danish IP address,
  • – let customers to stay on this website if there is no specific language website version for them (based on their IP again).

What is the easiest way to accomplish it?

Tapping into switch_to_blog() Function Performance

It just happened that in my WordPress-related work I focused mostly on WordPress Multisite. I had a couple of big client projects in the past, then I developed WordPress plugins for multisite specifically, for example this one or this another one and here we go.

So I have quite a picture in my mind how the things should work the best.

In this tutorial I am about to talk about switch_to_blog() function, especially about its usage within a loop:

  • How does it work exactly?
  • Is it slow?
  • Can we improve it somehow?

First of all let me show you a code snippet I am talking about.

Importing Products in Multisites

Recently I was testing my new plugin related to a multisite network of WooCommerce stores and noticed that before doing a product import into one of the stores in a network you first need to do some additional network configuration.

I mean if you just go to a product import and try to upload a CSV file for example, you will definitely get an error like that:

product import error when importing WooCommerce product in a Multisite network
Trying to upload a CSV or TXT import file will cause this error when running a WooCommerce store within a multisite network. The error message can be like on the screenshot “Sorry, you are not allowed to upload this file type” or “Sorry, this file type is not allowed for security reasons”.

Add a Super Admin User in phpMyAdmin

Sometimes when you work with WordPress multisite network you may need to create a super administrator user not from the dashboard, but from the database with the help of SQL queries.

And in this tutorial I am about to show you how. There are actually only two steps we need to do:

How to Check if Plugin is Active in Multisite Network

When it comes to plugins installed on WordPress Multisite network, some of them can be activated either for the whole network or for a specific site of the network only.

Network activated plugin:

network activated plugins within a WordPress multisite network
When you “Network activate” a plugin, it will be automatically active for every site in your network. Yes, it sounds obvious, but just in case.

The same plugin is activated site-specific:

Site-specific plugin activation in WordPress Multisite

It shouldn’t be a problem to understand how it works, the problems could appear when we try to check whether a plugin is network or site-specifically activated in the code.

There are multiple ways to do that and each of them is quite different.

Multisite User Sync

Recently I’ve developed a user syncronisation plugin which allows to share users between multiple WordPress websites and uses REST API. But when I tried to explore what similar plugins are already out there I found a couple of WordPress Multisite user sync plugins.

And in this moment I don’t fully get it what those plugins do, because users within a multisite network are already shared between blogs.

Let’s figure it out in this post.