For many businesses that run globally, the website needs to provide content that international clients can access. Adding the other languages’ content on your site is mostly necessary. Earlier, I published the “Top FREE WordPress Translation Plugins Compared” post. Today I will talk about how to set up WordPress Multisite for Multilingual sites.
Why and When we can use Multisite for Multilingual sites
What is WordPress multisite
Before we go further, I like to talk about what is WordPress multisite. Basically, it is a network site that contains mini-sites. In one network, you can have many mini-sites as you want. Each mini-site is just like a single WordPress site. Each mini-site is separate from the others. You add the content to one mini-site, this content doesn’t available to other mini-sites.
You can have the network admin that can access all mini-sites with one user account. Each mini-site can have its own user account just like the single WordPress site.
Not every plugins and themes support the multisite. If you want to install the theme or plugin on your multisite, you need to check with the theme or plugin owner first.
When we can use the Multisite for Multilingual sites
When your site is a content site. It is not an online shopping site or e-commerce site. For example, your site is the company website that presents the content only. In my opinion, online shopping or e-commerce site should use the translation plugin.
However, if your content site plans to have more than two languages, I suggest you use the translation plugin instead.
How do we set the languages for Multilingual sites
The idea is, each mini-site presents one language. Then we will use a plugin to help switch between mini-sites. So if you are on the contact us page in English when you switch to the French language, the contact us page for Frech will display.
Basically, we will set up the network site first. Then we create the mini-sites for each language. Finally, we install the plugin to help switch between the language. That is the whole tutorial today.
Before you create a network
There is a useful article to read before continuing below.
How to set up WordPress multisite
Here is the reference I follow on “How to create a network“.
Step 1: Backup the existing single WordPress if any
If you already have the existing single WordPress site and want to change to the network site (multisite), I strongly recommend backup your database and files before continuing.
Because some plugins may not support the multisite, you should deactivate all active plugins from the existing single WordPress site before activating the multisite.
If your install a fresh single WordPress site, just continue.
Next, we want to enable the Network Setup menu so that we can copy the network configuration to our wp-config.php and .htaccess files.
To enable the menu, add the code below into your wp-config.php above where it says
/* That's all, stop editing! Happy blogging. */
/* Multisite */ define( 'WP_ALLOW_MULTISITE', true );
Refresh your browser to see the change.
Step 3: Create a Network of WordPress sites
Setup Network title and Network Admin Email
From step 2, at the admin panel, you will see the new Network Setup menu under Administration>Tools menu. Click on the new menu then you will need to add the Network title and Network Admin Email. They both can change later.
The Network title is the title of your network. The Network Admin Email is the super admin of the network.
For the fresh WordPress installation, you must CHOOSE between the sub-domains or sub-directories.
For the existing WordPress site that has been set up for more than a month, you can use only sub-domains. Due to the existing permalinks issue.
Review the details and click on the Install button.
Additional: Switch network type (sub-domain and sub-directory)
It is possible to switch between sub-domain and sub-directory installation after finishing the final step. However, you can not switch from sub-directory to sub-domain when running on 127.0.0.1 or localhost. This can potentially cause an endless loop of reauth=1 on your root site due to cookie handling.
To switch the network type, make sure your site won’t have conflicts after switching. For example, sample.com/pagename and sample.com/sitename.
Before switching, please back up your files and database.
Now in the wp-config.php, you will look for SUBDOMAIN_INSTALL and change its value.
define( 'SUBDOMAIN_INSTALL', true ); // for sub-domain
define( 'SUBDOMAIN_INSTALL', false ); // for sub-directory
Next, you will need to change the .htaccess file. Go back to “Network admin/Settings/Network Setup” then copy the new .htaccess and replace the existing one in your .htaccess file. Finally, you may refresh or log out and log in again.
Here is the link to “Switching network types“.
Step 4: Enabling the Network
From step 3, once you click on the install button, you will see the instruction after enabling the Network on the admin screen. Follow the instruction carefully. Might be a good idea to back up the wp-config.php and .htaccess files before doing the changes if you are installing the network site on the existing single WordPress site. The instruction will update the wp-config.php and .htaccess files.
After you update those two files, it will log you out and you need to log in again.
Step 5: Network Admin Settings
After login, on the top bar, you will see the “My Sites” menu with the multi-houses icon. In this menu, you will see the Network admin menu and all mini-sites you create. The first time after enabling the Network, you will see only two menus which are the Network admin and single WordPress site.
On the Settings screen, you can change the Network title and Network Admin Email which we already set from the early step. You can also set the Registration settings, Email message settings, Upload settings, Language settings, and Menu settings. These settings are for the whole network.
More detail about the Network Admin and Network Admin Settings Screen.
Final Step: Add a new mini-site
At the Network Dashboard, add the new site from “Sites>Add New”.
For our purpose, we want to set
Switching between mini-sites (languages)
Install a Multisite Language Switcher plugin
The last step is to switch languages by using Multisite Language Switcher plugin. To do that, at the Network Admin dashboard, install the Multisite Language Switcher plugin. Then active it. It will activate for all mini-sites automatically.
Configuration the plugin
Next, go to each mini-site and set the configuration in “Settings>Multisite Language Switcher“. You want to make sure you have your super admin user for all mini-sites. So when you view the “MySites” menu you will see all mini-sites.
For a network site, the user access permission is the same as for a single WordPress site. You need to add the users to the mini-site that they can access.
Shortcode and PHP code
Finally, add the language switcher shortcode to the widget or page builder, or block editor.
For the widget, uses [sc_msls_widget]. For the page builder or block editor, uses [sc_msls].
If you prefer to add the PHP code to your template file then use the snippet below.
<?php if ( function_exists( 'the_msls' ) ) the_msls(); ?>
How to connect the translation page using the plugin
When you want to connect to the translate page or post, you can connect via the pages or posts manage page (Posts menu or Page menu or your custom post type menu), or connect at the edit page, edit post or edit your custom post type page.
And that’s it.
Multisite Language Switcher useful links
Here is how to install the Multisite Langauge Switcher plugin.
Here is the Multisite Language Switcher website.
- Create A Network
- Before You Create a Network
- Network Admin
- Multisite Network Administration
- Debugging a WordPress Network
- Pretty Permalinks
- Giving WordPress its Own Directory
- How to adapt my plugin to Multisite? – For developers who develop their own plugins.
- Installing Multiple WordPress Instances
- Clone the subsite to another sub-site in the same network – I recommend creating the full backup before cloning with this plugin.
- With multisite, only the super admin can manage and access the plugins. If you want the admin or editor role can access the plugins on each subsite, you can use the User Role Editor.
- If you need a slider that works for the multisite, I strongly recommend the Smart Slider 3. It is a layer slider and you can control pretty much everything. Buying the pro version is just pay a one-time payment. To grant access to the slider plugin for other user roles except for the super admin, you can use the User Role Editor and follow this doc.
- If you need the backup and restore plugin, try the UpdraftPlus plugin.
- How to move WordPress site to a New Host without Plugin
- How to move your WordPress site with Plugin
- How to move your WordPress site to a New Host with No Downtime
A network or a multisite is a unique feature of WordPress. Understand its structure and its benefit of it, you can apply it to match your need easily. Keep in mind, not every plugin and theme fully supports the network site. When you try to set up the network site from the existing single WordPress, you should back up your files and database.
Hope this post is helpful. If it saves you time and is useful, please consider buying me a coffee. Coffee makes me smile.