WordPress Multisite

Since WordPress version 3.0, it is possible to create networks of sites, where there is one main site with a super administrator and as many subsites as needed, each with its own administrator. This installation mode is called Multisite, and historically it has been briefly referred to as MU (MultiUser).

This guide shows how to create a network of sites on WordPress by installing WordPress in Multisite mode.

Multisite is the new name for the former "WordPress MU," which was a plugin until WordPress version 3.0 and then became part of WordPress.

Features of Multisite

When installing WordPress in "Multisite" mode, all sites in the network will be stored in a single database, in a single folder on the server, and will be managed by a single installation (core) of WordPress. There can be an unlimited number of sites. Each site in the Multisite network is configured separately. However, plugins, themes, and users become shared, which is convenient.

Features and advantages of "Multisite":
  • In MU: a single engine, one database, shared themes and plugins, a shared folder on the server, and therefore:

    • WordPress is updated once for the entire network of sites;
    • Plugins and themes are installed once for the entire network;
    • Plugins and themes are updated once for the entire network;
    • A plugin can be activated for a specific site in the network or for all sites at once;
    • A theme can be "enabled" for a specific site in the network or for all sites at once;
    • If the same theme is used on several sites in the network, it can be modified by creating a child theme.
  • A single user table in the database:

    • When registering on one of the sites in the network, a user gets an account for the entire network;
    • An existing user in the network can be quickly added to the sites in the network;
    • An authorized user will be authorized on all sites in the network to which they are connected;
    • Users can have different roles on different sites in the network;
    • The super administrator can allow users to create their own sites in the network;
  • The address (URL) of the network site can be of three types:

    • Subdirectory - example.com/site1.
    • Subdomain - site1.example.com.
    • Separate domain. Since version 4.5, this capability has been integrated into the core, more details here. Before this version, a plugin had to be installed for this: WordPress MU Domain Mapping.
  • In MU, it is very convenient to retrieve data from one site in the network on another site and vice versa;

  • Must-use plugins (mu-plugins) will work for all sites in the network. They cannot be disabled for a specific site. Their presence will only be visible in the plugins of the entire network, while in the plugins of a specific site they are hidden;
Disadvantages of Multisite:
  • Maintaining a network of sites is more complex - it requires more knowledge and skills.
  • Many less popular plugins do not work in this mode.
  • The size of the database grows with each new site.
  • Hosting resources will be shared among all sites, and there is no possibility to separate sites between different hosting platforms.
  • FTP access and database access will also be shared among all sites. This can sometimes become a problem.
  • When updating the core of WordPress or plugins, changes will affect the entire network of sites... This may cause issues on some sites in the network.

When can Multisite be useful?

Most often, it is simpler to use a separate installation of WordPress and not delve into the intricacies of a network of sites. But sometimes the MU mode can be indispensable or simply save a lot of time.

MU is well suited in the following cases:

  • When you have several closely related sites. For example, you have 3 very similar sites: "bathroom renovation", "living room renovation", "bedroom renovation", and each of them needs a separate domain...

  • MU is great for creating multilingual sites - one subsite = one locale.

  • When a single account is needed for authorization on different sites.

In other cases, I would recommend using a simple installation of WordPress. With it, you won’t have a bunch of unnecessary questions - it’s easier!

Managing the Network

After installing MU, a new role “Super Administrator” appears and a new section “My Sites” with a nested item “Network Management” - remember this item, you will use it often.

The super administrator can manage the entire network through the "Network Management" menu item. In it, you can create sites, new users, install, delete, enable, and disable plugins and themes, etc.

Super Administrator Console

Otherwise, when you switch to a specific site, everything is absolutely the same as in a regular installation of WordPress. The only difference: on the user addition page, we can attach existing users to the current site.

Attaching Users in Multisites

A few more features for beginners:

Plugins: after installing a plugin, the super admin can enable the plugin for all sites in the network at once. Or you can switch to a specific site and activate the plugin only for the current site in the network.

Users: the super admin can create a new user or attach an existing one to the specified site.

Themes: after installing a theme, the super admin can allow the use of the theme for all sites at once. Or you can go to the settings of a specific site in the "network of sites" section and allow the theme to be used only for it.

Setting Up a Separate Site in Multisite Mode

Structure of Sites and Blogs

When MU is installed, 3 new concepts appear: networks, sites, and blogs. To clarify many things, let’s look at how the options of each type are stored.

In WordPress, there are four similar functions for retrieving options:

  1. get_network_option()
  2. get_site_option()
  3. get_blog_option()
  4. get_option()

These functions can be grouped:

get_network_option() is equal to get_site_option()
get_blog_option() is equal to get_option()

“Sites” are also “Networks” in MU

These are the main sites (which are also blogs). Usually, there is only one main site. It has all the same data as any blog (its own wp_options table). However, it also has its own options, which are located in the wp_sitemeta table. It is from wp_sitemeta that the functions: *_network_option() and *_site_option() retrieve data.

get_network_option() - this is a fundamental function, you can specify the network ID (main site) for which you want to retrieve options. And get_site_option() - this is its wrapper, and in it, you cannot specify the network ID - the current network is always used.

I repeat, in a multisite installation, usually only one main site (network) is used, which means that in 99% of cases the option get_network_option() is equal to get_site_option().

“Blogs” in MU

These are sites that are managed by the main site (network). Each of these blogs has a separate *_options table. get_blog_option() retrieves data from this table. Essentially, it is a wrapper for the get_option() function, only it retrieves the options of the specified blog, not the current one.

Differences Between Multisite and Regular Installation

Differences in Files

Files are uploaded to the same directory wp-content/uploads. Moreover, nothing changes for the main site of the network. Changes are only visible for additional sites in the network: their files are uploaded to a new folder wp-content/uploads/sites/2, where 2 is the ID of the network site.

File Location in Multisite Network

Differences in Database Tables

6 new tables are created with the prefix of the main site. The tables: users and usermeta become common for all sites in the network. Such tables are created separately for each site and differ by prefix; for example, if for the main site it was wp_, then for the first site in the network it will become wp_1_.

What additional tables are created:

wp_blogs
All sites in the subnet.
wp_blogmeta

Since version 5.1. More details. A table for global options of the network site that are intended to be used across the site network, not separately on the site. Separate site options should be stored in the options table of the individual site. Do not confuse with wp_sitemeta.

Related functions:

get_site_meta( $id, $meta_key, $single )
update_site_meta( $id, $meta_key, $meta_value, $prev_value )
add_site_meta( $id, $meta_key, $meta_value, $unique )
delete_site_meta( $id, $meta_key, $meta_value )
wp_blog_versions
Contains the current version of the database for each site. The data is updated when the database is updated for each site in the network.
wp_registration_log
Contains data about the site administrators created when sites are created.
wp_signups
Contains users who were registered through the basic WordPress registration from the page: Administration > Super Admin > Settings.
wp_site
Contains the addresses of the main sites.
wp_sitemeta
Data of the sites: various options, including the site administrator.
wp_users
A list of users across all sites in the network. This is a shared user table for the entire network. This is a familiar table, only in the multisite version, two more fields are added: spam and delete.
wp_usermeta
Contains metadata of users. User settings for different sites in the network.
Basic tables of each site in the network
wp_posts, wp_postmeta, wp_options, wp_terms, etc. Identical tables are created for each site in the network, but with different prefixes: wp_options, wp_1_options, wp_2_options ...

-

The following materials and personal experience were used in writing: