How to install and set up a WordPress Multisite

How to install and set up a WordPress Multisite

How to install and set up a WordPress Multisite
In this tutorial we explain how you can install and set up a WordPress multisite to build a network of websites. We assume that you already installed a WordPress Single Site. Moreover we assume you have FTP access to the directory of your WordPress installation, as you need to change some files.

Table of Contents

Install WordPress Multisite – the RequirementsAllow Multisite in wp-config.phpInstall the WordPress NetworkAdd some code to wp-config.php and .htaccessMenu network administration and the network settingsAdd a new website to the networkInstall Plugins and Themes in the WordPress multisite
1. Install WordPress Multisite – the Requirements
Before you start to install the WordPress multisite, please make sure that:

You already have a WordPress installation
Pretty Permalinks are activated. This means your URLs should not look like this  http://example.com/?p=2345, but rather like this http://example.com/my-page
All plugins are deactivated
Important: you have a backup of your WordPress installation
You have FTP access to your WordPress installation

2. Allow Multisite in wp-config.php
The first step is to activate the Multisite feature in the file wp-config.php.

Set up a FTP connection to your website.
Open the file wp-config.php, which is is located in the main directory of your WordPress, and add the line
define('WP_ALLOW_MULTISITE', true);
above the line:
/* That's all, stop editing! Happy blogging. */
Define WP_ALLOW_MULTISITE in wp-config.php to enable the Multisite feature.
Save the file wp-config.php.

Now you enabled the Multisite feature in your WordPress installation. But you haven』t finished yet. The next step is to install the network.
3. Install the WordPress Network

Refresh the page in your browser and log in to your website.
In the left sidebar under Tools you will find the menu tab Network Setup, where you can configure your WordPress Multisite.
Install a WordPress Multisite – Settings page 「Create a Network of WordPress Sites」
Decide whether you want to use subdomains for the sites in your network (e.g. site1.example.com) or whether you want to have them installed in subfolders (e.g. example.com/site1).  This setting affects all the sites in your network, you cannot change that later on.  Do you need a site to be mapped to a top level domain (e.g. mydomain.com)? This is possible with domain mapping.

Enter a name for your network in the field Network Title in the section Network Details.

Enter the site admin』s e-mail address.

Click the Install button.

4. Add some code to wp-config.php and .htaccess
WordPress will now provide you with two snippets of code, which you need to add to the wp-config.php and .htaccess files. Both files are located in the root directory of your WordPress.

Set up a FTP connection to your website.
Add the first code snippet to your wp-config.php directly above the line
/* That's all, stop editing! Happy blogging. */
The snippet looks like this, but adapted to your own site:
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'My Website');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Add the second code snippet to the .htaccess file and replace other WordPress rules.
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]

Save both files.

5. Menu network administration and the network settings
When you changed the wp-config.php and the .htaccess, log into your WordPress admin area again. In the upper admin bar, you now see the new menu Network Admin. It』s displayed always, so you can always enter the admin area of the network, no matter on which site of your network you are. We take a look at the sub menues later on.
Below the network administration, all sites of the network are listed to which you were added. By clicking on the names, you enter the backends of these sites.
The menu Network Admin of WordPress multisite
And here』s the explanation of the menu tabs in the network administration:

Dashboard: Here you can find the widget to add new users and new sites to your network.
Sites: On this tab, you can see all sites of your network – similar to the posts and pages. By moving the cursor over the websites, you see for example links to edit, display the dashboard, view, delete, archive or deactivate the sites. Note that you have fewer functions for the main page of your network, as this one always needs to exist and you cannot delete it.
Users: Here you can administer the users of your network. In contrast to a single site installation, you can assign the super admin user role. The super admin has access to all sites and can make changes within the whole network. If you want a user to have access to the sites of your network, you need to add the user to each site via the user administration of the sites.
Themes: The theme administration. Here you can install and uninstall themes and activate or deactivate them for the whole network.
Plugins: Here you can find all installed plugins. You can add new plugins or delete them, you can activate or deactivate them for the whole network.
Settings: On this tab you can find and edit the basic settings for your site, for example: the network name and the admin E-Mail address, you can allow user registrations, add new users to the site admins, you can make the themes and plugins menu available for site admins or set the standard language of your sites.

6. Add a new website to the network
A WordPress multisite with only one website doesn』t really make sense. To a WordPress multisite, you can add as many websites as you want – always and any time, so, it needn』t be at the beginning. To enhance your website with a new site, take the following steps:

Go to My Sites → Network Admin → Sites and click Add new.
Add a new website to a multisite
Enter the desired website address. In this case, we decided for a network with sub directories. The domain is already given, we just add the sub diretory.
Settings for the new website in the multisite network
Define a title of the website. This one is displayed at several positions in your network, for example in the backend as website name in My Sites, but maybe also in the frontend or in meta data like the page title.
Choose a language for the new website.
Choose the admin e-mail address which must be different than the one for the whole network. If there is no user with this e-mail yet, a new user with admin role for this site will be created.
Click the button Add Site. Your new site is to be created and will be displayed in My Sites  → Network Admin → Sites. However, in order to let others than the current admin administer this new site, you need to add them as user with admin role to this site.

7. Install Plugins and Themes in the WordPress multisite
Install or uninstall plugins or themes in a WordPress multisite network is something only the super admin can do. The site admins within the network can only activate or deactivate them. Well, and site admins can only activate and deactivate plugins in case the super admin checked the box Enable administration menus in the network administration in Settings → Network Settings.
Enable administration menus to allow admins to enable/disable plugins.
You can find the plugins administration for the whole network under Network Admin → Plugins, the themes administration under Network Admin → Themes.
Install plugins in a multisite and make them available for the whole network
For the site admin, the whole thing looks like the next picture.
The plugins administration as site admin in a WordPress multisite
Hint: The admin can activate and deactivate plugins, but he cannot install or uninstall them.
For one of the plugins in our example you can read Network Only. This means the plugin is available only for all sites or for no site. Moreover, it』s the super admin only who can set the settings of this specific plugin, you need to make them in the network administration.
You can find further help to set up your multisite in our documentation category WordPress Multisite 1×1. In case you are setting up a multilingual website, take a look at: MultilingualPress getting started.

How to create a custom language switcher in MultilingualPress 3

How to create a custom language switcher in MultilingualPress 3

How to create a custom language switcher in MultilingualPress 3
In this tutorial we will create a custom language switcher using the MultilingualPress 3 API. We will start creating a simple language menu and then convert it to a select dropdown. Finally we will explain how to add the language switcher to a WordPress widget.

Table of Contents

Get translations for the current pageCreate a translations menu at the beginning of Post contentCreate a language switcherAdding the language switcher to a Widget
1. Get translations for the current page
In order to create a language menu you need a way to get the translations for a particular page. MultilingualPress provides the Translations class which accepts search parameter from TranslationSearchArgs class like this:
function multilingualpress_get_translations()
{
$args = InpsydeMultilingualPressFrameworkApiTranslationSearchArgs::forContext(new InpsydeMultilingualPressFrameworkWordpressContext())
->forSiteId(get_current_blog_id())
->includeBase();

$translations = InpsydeMultilingualPressresolve(
InpsydeMultilingualPressFrameworkApiTranslations::class
)->searchTranslations($args);

return $translations;
}
The above function returns an array of translations, each one containing information like remote_url and language info. You can then loop through the array to get the translations:
$translations = multilingualpress_get_translations();

foreach ($translations as $translation) {
$language = $translation->language();
$language_iso_name = $language->isoName();
$language_locale = $language->locale();
$url = $translation->remoteUrl();
}

2. Create a translations menu at the beginning of Post content
Now that we know how to get the translations of a page, we can create a menu. So lets start adding one before the content of the post. To do so we can use the WordPress filter 『the_content』:
add_filter('the_content', function ($content) {
if (!is_single()) {
return $content;
}

$translations = array_reverse(multilingualpress_get_translations());

if (!$translations) {
return $content;
}

$output = '';
$items = '';
foreach ($translations as $translation) {
$language = $translation->language();
$iso_name = $language->isoName();
$url = $translation->remoteUrl();

if ($url) {
$items .= "

  • ${iso_name}
  • ";
    }
    }

    if($items) {
    $output .= '

      ';
      $output .= $items;
      $output .= '

    ';
    }

    return $output . $content;
    });
    As you can see at the beginning we return default content in case we are not in a single post page but also in case there are no translations. Then we create the HTML markup for the menu looping through the translations array. Finally we only display the menu in case there are items containing a URL.
    3. Create a language switcher
    We can use part of the previous code but this time we will change the markup to use a select instead of an unordered list:
    ...

    foreach ($translations as $translation) {
    $language = $translation->language();
    $iso_name = $language->isoName();
    $locale = $language->locale();
    $url = $translation->remoteUrl();

    if ($url) {
    $items .= "${iso_name}";
    }
    }

    if($items) {
    $output .= '';
    $output .= $items;
    $output .= '';
    $output .= '';
    $output .= "jQuery('#multilingualpress-language-switcher').change(function() {window.location.replace(jQuery('#multilingualpress-language-switcher option').data('url'));});";
    $output .= '';
    }
    ...
    Also we use a bit of JavaScript to fire a page redirect when selector is changed.
    4. Adding the language switcher to a Widget
    Finally the code snippet below shows how to add the above language switcher to a widget:
    add_action( 'widgets_init', function(){

    register_widget( 'Language_Switcher_Widget' );

    });

    class Language_Switcher_Widget extends WP_Widget {

    public function __construct() {
    $widget_ops = array(
    'classname' => 'language_switcher',
    'description' => 'Language Switcher',
    );

    parent::__construct( 'language_switcher', 'Language Switcher', $widget_ops );
    }

    public function widget( $args, $instance ) {
    echo $args['before_widget'];
    $translations = array_reverse(multilingualpress_get_translations());
    if (!$translations) {
    return $content;
    }

    $output = '';
    $items = '';
    foreach ($translations as $translation) {
    $language = $translation->language();
    $iso_name = $language->isoName();
    $locale = $language->locale();
    $url = $translation->remoteUrl();

    if ($url) {
    $items .= "${iso_name}";
    }
    }

    if($items) {
    $output .= '';
    $output .= $items;
    $output .= '';
    $output .= '';
    $output .= "jQuery('#multilingualpress-language-switcher').change(function() {window.location.replace(jQuery('#multilingualpress-language-switcher option').data('url'));});";
    $output .= '';
    }

    echo $output;
    echo $args['after_widget'];
    }
    }

    How to set up the automatic language redirection

    How to set up the automatic language redirection

    How to set up the automatic language redirection
    This tutorial is part of our MultilingualPress 2 documentation. In case you are using the newer version 3, please switch to MultilingualPress 3.
    If you have a multilingual website, it is extremely important that your users get to the language they understand the most. The feature automatic language redirection in MultilingualPress is taking care of that. In the following text you can find information about how the automatic language redirection works and how you set it.

    Table of Contents

    How does the automatic language redirection work in multilingual websites?Browser settings for the languageMultilingualPress priorities for languagesHow to find out language of browser setting and MultilingualPress prioritiesHow to set the automatic language redirection in MultilingualPress
    1. How does the automatic language redirection work in multilingual websites?
    1.1. Browser settings for the language
    Users can add their preferred languages in the settings of each browser so that multilingual websites can take them into account. So the user adds which languages he speaks and also indicates his preferred order.
    The following screenshot shows the corresponding setting in firefox.
    Firefox language setting
    1.2. MultilingualPress priorities for languages
    Additionally to the browser settings there is a MultilingualPress setting for the automatic language redirection. And we offer the possibility to point to the qualitiy of your translations by assigning priorities for each language.
    To set the automatic language redirection, go to Network Administration → Settings → Language Manager. There you can see all languages being available in MultilingualPress by default. The column rightmost lists priority, where you can add numbers on a scale from 1 to 10 for each of your translations. The language with the translation of highest quality gets the 10. Attention: the worse the translation, the lower the priority.
    Language Manager
    1.3. How to find out language of browser setting and MultilingualPress priorities
    MultilingualPress multiplies each browser setting with the priorities being indicated in the language administration and the rule for the language selection is: The higher value wins. Experts call this Language Negotiation. 
    In case the language with the highest level complies with the current language, there is no language redirection. The user is redirected neither to another language in case he or she goes to another language through a link generated from MultilingualPress  (e.g. in the language widget, in quicklinks or in the menue).
    You can find a very detailed description about the language redirection in this article.
    2. How to set the automatic language redirection in MultilingualPress
    Requirement: For the automatic language redirection you need to have created at least two sites in your multisite. Then you need to assign a language in the MultilingualPress Tab. Did that? Great. Morover, you need to link the sites with each other.
    Automatic language redirection

    Go to Network Administration and then to Settings → MultilingualPress. Then set a hook at HTTP Redirect.
    HTTP Redirect – Redirect visitors according to browser language settings.
    Go to Sites → All Sites and edit a website.
    Click at the tab MultilingualPress and set a hook at Enable automatic redirection.
    Enable automatic redirection
    You need to do these steps for all websites that are linked to each other. In Sites → All Sites there should be a hook in the column Redirect for sites with activated language redirection.
    Activated language redirection

    Can I use MultilingualPress in a single-site WordPress installation?

    Can I use MultilingualPress in a single-site WordPress installation?

    Can I use MultilingualPress in a single-site WordPress installation?
    You cannot use MultilingualPress in a single-site WordPress installation. For MultilingualPress you need to have a WordPress multisite installation.
    Explanation in Detail: Why you can use MultilingualPress only in a WordPress multisite installation
    To enable the use of MultilingualPress for a single site, we would have to interfere with the way WordPress saves content. However, there are plugins that accomplish exactly that. But we think this is a bad idea. After deactivating the plugin, you would lose access to your translated content.
    The entire concept of MultilingualPress is based on using a corresponding site for each language (in the WordPress network, this means a multisite). Links between sites and between translated content (e.g. posts or terms) are saved in separate plugin tables. This makes it possible for the individual sites only to store the actual non-manipulated content, that is, without injected shortcode, as is (necessarily) the case for some single-site plugins.
    If you currently have a single-site installation, you can change this to a multisite. You can find detailed instructions for this here.

    How to manually migrate from MultilingualPress version 2 to version 3

    How to manually migrate from MultilingualPress version 2 to version 3

    How to manually migrate from MultilingualPress version 2 to version 3
    MultilingualPress 2 to 3 Migration Tool has been released! This tool lets you easily load your content from the MultilingualPress version 2 to version 3. So, you don』t have to migrate manually. Check it out!
    In case you prefer manual migration, we are going to provide you four steps to migrate MultilingualPress version 2 to version 3 manually.
    Please, before following these instructions, keep in mind that purchasing a valid MultilingualPress 3 license in our shop is required. MultilingualPress 3 is currently available only as a pro version.

    Table of Contents

    Create a backup of your siteDeactivate and uninstall MultilingualPress version 2Install and activate MultilingualPress version 3Connect all the sites and the relative content translations
    1. Create a backup of your site
    We need this for safety reasons, since if a mistake occurs during your migration process (yes, you are a very careful user, but you can』t know where errors hide, do you?) you will always be able to recover your website. Don』t you know how to create a backup? In that case let me suggest you this link: https://codex.wordpress.org/WordPress_Backups
    If you instead prefer an automated solution, consider our free WordPress Backup Plugin BackWPup. This will let you build your backup quickly and easily.
    But if a simple backup is not enough and you need a complete automated solution, that can also perform automated restore, encrypt your data, and provide other professional features too, consider our pro version WordPress Backup Plugin BackWPup Pro. With this your data loss fears have come to an end.
    2. Deactivate and uninstall MultilingualPress version 2
    Now that you have done the backup, it is time to get rid of MultilingualPress 2; to do that just go to My Sites > Network Admin > Plugins and Network Deactivate the plugin. Then delete it using the proper links. This process will not affect your language sites and content, they will continue to be available. But now the plugin doesn』t connect them anymore.
    3. Install and activate MultilingualPress version 3
    Get your MultilingualPress version 3 package and Network Install it in your Multisite environment using the proper link. After that, always through the proper link, Network Activate it. That』s it.
    4. Connect all the sites and the relative content translations
    Finally, we have reached the last step to accomplish the MultilingualPress version 2 to version 3 migration process. We now have to rebuild the connections between our content (post, pages, products, …). To achieve that you can first relate your language sites through the MultilingualPress settings, then use the translation metaboxes to properly relate your content.
    If you also used the language switcher in version 2, this needs to be rebuilt now.
    More information about all these topics can be found in our docs. So if you need help in connecting sites and relate content translation, or how to set the language switcher, please refer to these links:

    https://multilingualpress.org/docs/getting-started-with-multilingualpress-3/

    MultilingualPress 3 (and higher) – Common Questions & Answers

    Consider also that if you used country flags in your sites through the version 2, this feature is still available in version 3, but requires an additional extension that can be requested directly by the support.
    So, feel free to contact us for this or for any related need!

    WordPress Multisite Pros and Cons

    WordPress Multisite Pros and Cons

    WordPress Multisite Pros and Cons
    When you need to build a network of related sites, to choose whether rely on different single site WordPress installations, or on a WordPress Multisite installation, is not a trivial issue. In fact there are many aspects you need to consider.
    Here follow several pros and cons of using a WordPress Multisite installation to build your site network.

    Table of Contents

    The Pros of a WordPress MultisiteThe Cons of a WordPress Multisite
    1. The Pros of a WordPress Multisite

    Manage all sites from the same dashboard, through a single Super Admin user.
    The site administrator cannot install or change plugins and themes, only the Super Admin can do this. This lets you more control and avoids conflicts, keeping control centralized.
    You need to install themes and plugins only once and then you can activate them across the entire network. Also you execute the upgrade process only once.
    Store all sites data in a single backup, no need to backup each site.
    Since every WordPress installation takes a considerable amount of resources on the server, using a Multisite installation you don』t spend so much resources (and money) and the optimization process can be less painful.
    You can properly configure and maintain multilanguages versions of the same site through a multisite structure and multi languages plugins.

    2. The Cons of a WordPress Multisite

    Not all plugins work on multisite. Usually most plugins are basically created for single site and this can lead to conflicts.
    Individual site administrators cannot install/uninstall plugin and themes, this limits site administrators power.
    A hacker attack or just a downtime on your server will affect all the sites.
    A data breach will involve all the data of all the sites.
    Big traffic on one site may affect the speed of all the other sites of the network, for bandwith reason but also because all sites share the same database.
    Not all hosting plans support multisite.
    If you need to keep users on separated sites, Multisite can lead to security risk, due also to eventual leaks in plugins/themes.
    If a theme or a plugin is updated, it is updated for all sites of the network that use it. Change versions between sites could be complicated.
    If the number of sites increases, to manage it within a multisite installation could be critical.
    There could be some reasons that make you want to change a multisite installation into different single sites installations: for example if one site becomes too big, or just the number of sites increases too much making the whole system slow. To switch from multisite installation back to single site is hard to achieve.
    In case of testing new plugins/themes features, for a single site administrator is difficult to work because he cannot activate/deactivate or install/delete it since this can be done only through the Super Admin user.
    All sites share the same user profiles. You cannot create for example the same user two times for two different sites on the network. Besides logged in users are logged in for all sites.

    Further reading about WordPress Multisite Pros and Cons:
    wpexplorer.com – Pros and Cons of WordPress Multisite – How to Install Multisite With Local Xampp
    Quora – Are there any disadvantages to using WordPress Multisite?
    narga.net – WordPress Multisite vs Multiple WordPress Installations
    wpmudev.org – Multisite Pros & Cons

    The WordPress Multisite Overview with Examples

    The WordPress Multisite Overview with Examples

    The WordPress Multisite Overview with Examples
    You wonder what the WordPress multisite is about? With our WordPress multisite overview, we want to give a first impression about the WordPress multisite feature.
    You can find even more details in the category WordPress Multisite 1×1 in our MultilingualPress documentations. As a beginning, we recommend our post Install and Set up WordPress Multisite.

    Table of Contents

    What』s the WordPress Multisite? – A Network of WebsitesSingle Site and Multisite: The DifferencesAdmin ScreensFilesDatabaseOverview of Multisite FeaturesWordPress Multisite Overview – Use Cases and Examples
    1. What』s the WordPress Multisite? – A Network of Websites
    The multisite is a WordPress feature with which users can create a network of websites in a single WordPress installation. This way, users can administrate websites professionally.
    Multisite is available since WordPress 3.0 and was created out of  WPMU (WordPress MultiUser).
    The great thing about a WordPress multisite is the fact that it looks very similar to a standard installation. The multisite installation has the same folder structure, the same basic files and the same code base. That』s what makes the installation of a multisite network nearly as easy as the installation of a standard WordPress site (WordPress Single Site). And updates of a multisite are a piece of cake, too.
    2. Single Site and Multisite: The Differences
    However, there are some differences between a WordPress Single Site and a Multisite . There are differences between the admin screens and their usage, between the files in your WordPress installation and between the database files.
    2.1. Admin Screens
    As soon as you activated the multisite, you see some more screens in the admin area to administrate the network.
    WordPress Multisite Overview – Multisite Admin Dashboard
    Only Super Admins see this admin area. They can install themes and plugins and create and administrate sites. Besides to the role Super Admin, you can assign the role 「standard」 admin for admins of websites within the network. Owners of this role cannot install themes and plugins but can only activate those which were installed within the network.
    2.2. Files
    The only differences between files of the standard WordPress installation and the multisite installation are those of the wp-config.php file, the .htaccess file and the wp-uploads folder. As soon as you installed the multisite network, there are a few more lines of code in the wp-config.php file, which tell WordPress how to run. The wp-uploads folder contains, in a WordPress multisite installation, sub folders for each single website. Files which have been uploaded to the websites are stored in the corresponding folder – with the same structure you have in the wp-uploads folder of the standard installation.
    2.3. Database
    The database of a standard WordPress installation contains of twelve database tables in which the page content and the settings are stored. In a multisite network, ten of these tables are duplicated for each website. This means: The more websites in the network, the more database tables. They separate the content of each website within the multisite network.
    3. Overview of Multisite Features

    You can create a network with a couple of blogs and websites out of only one single WordPress installation.
    Moreover you can have a network of subdomains like http://multisite.domain.com or directories like http://www.domain.com/multisite/ or have top level domains.
    Open a WordPress multisite network for other users to create accounts and blogs.
    All themes and plugins are stored only once – independent from the number of websites on which you use them. This means that you need less server space than with a WordPress installation of each website.
    There is the role of the Super Admin who is admin of the whole network and the website administrator role who administrates only one website within the network. As Super Admin, you can install themes and plugins and all admins of the websites within your network can activate them. Website administrators within the network don』t have the permission to install themes or plugins.
    As Super Admin, you can make changes of the themes for all websites. Website administrators cannot change anything concerning the theme.
    Create websites and shops for a couple of languages, regions, currencies and so on. The best plugin to use for multilingualism in WordPress is the plugin MultilingualPress, which is used with a WordPress multisite.

    Well, all this means that different websites may have the same design – or not. It』s the Super Admin』s decision what kind of themes and plugins are available for the website administrators to design their websites. With the help of MultilingualPress you can build a multilingual network of websites which are more or less different: the same or a different design, the same or different features, completely different content or just a few different words, different products or just another currency.
    4. WordPress Multisite Overview – Use Cases and Examples
    A multisite network has many use cases. For example you can use it to create a network of websites or blogs for several people or a whole company. Moreover, agencies or developers can use the network to keep the customer websites they install and administrate at one place.
    An example for the usage of WordPress multisite: A building materials company has a couple of stores with different corporate identities in an umbrella brand.  There, the company』s head quarter could make the administration of the whole WordPress installation, while each store can work on its own website within the network. Of course, each website can have the same elements to comply with the corporate design. The head quarters would do the WordPress updates and install plugins both for all websites and individual store requests. You can transfer similar approaches to universities with international focus: With the WordPress multisite, they can have multilingual websites in one installation. The use cases for the WordPress multisite feature are quite diverse.
    Here some examples:

    Inpsyde.com  – multilingual website
    WordPress Multisite Overview – Example inpsyde.com
    Multilingual online shop of Vectorcam
    WordPress Multisite Overview – Example Vectorcam
    Inpsyde product pages backwpup.com, backwpup.de, multilingualpress.de, and multilingualpress.org – here we have different products and different languages in one installation
    WordPress Multisite Overview – Example Inpsyde Product Pages

    However, there are some use cases in which the multisite isn』t the best solution. For example, if you』re not planning to have more than one website. Or in case you create several websites but your customers have different hosters.
    Our WordPress multisite overview was convincing? It』s exactly what you need? Then just start with the installation. Here you can find the tutorial how to install and set up a WordPress multisite.

    How to translate Taxonomy Slugs

    How to translate Taxonomy Slugs

    How to translate Taxonomy Slugs
    In this brief tutorial we show how to translate taxonomy slugs using the multilingualpress.filter_term_public_url filter hook available in MultilingualPress.

    Table of Contents

    Set the environment for our example code snippetImplement the snippet for slug translation
    Set the environment for our example code snippet
    Here below we provide an example snippet with two sub sites that have respectively an ID with value 1, and a second one with value 2.
    Of course this example uses two sites, but you can extend it: the ID values can be more, and in any case have to be properly set depending on the sites configured in your environment.
    Besides, in this example we assume that you previously registered the taxonomy My Taxonomy with slug my-taxonomy-slug in the network.
    Implement the snippet for slug translation
    In such an environment we can implement the taxonomy slug translation as shown in the filter below.
    add_filter(
    'multilingualpress.filter_term_public_url',
    function ($url, $sourceSiteId, $remoteSiteId) {
    $fragments = [
    1 => 'my-taxonomy-slug',
    2 => 'de-my-taxonomy-slug',
    ];

    if (empty($fragments[$sourceSiteId]) || empty($fragments[$remoteSiteId])) {
    return $url;
    }

    return str_replace(
    $fragments[$sourceSiteId],
    $fragments[$remoteSiteId],
    $url
    );
    },
    10,
    3
    );
    As you can see in the fragments array the proper slug translations are provided for every site. This is a key value pairs array, where keys are site IDs and values are the translated taxonomy slugs. The array elements can be extended depending the number of the sites you have in your Multisite network.
    Now, from the MultilingualPress settings, in the Translatable Taxonomies tab enable My Taxonomy.
    After that, in site with ID 1 create a new My Taxonomy term as My Term and connect it to site with ID 2. The snippet created will properly manage the translations of the slugs when switching between the two sites.

    MultilingualPress 2 to 3 Migration Tool

    MultilingualPress 2 to 3 Migration Tool

    MultilingualPress 2 to 3 Migration Tool
    This tool provides you a fast and easy solution to migrate your WordPress Multisite content from MultilingualPress version 2 (MLP 2) to version 3 (MLP 3).
    Please note: This is an alpha version and will be improved after some testing. Please do not use this on a live system.
    You can help us to improve the tool by sending us possible problems you discover via [email protected] or on Github.
    If you prefer to manually migrate from MLP 2 to MLP 3, you can follow this tutorial.
    The following documentation shows the essential steps to install and use the MultilingualPress 2 to 3 Migration Tool

    Table of Contents

    Requirements for MultilingualPress 2 to 3 Migration ToolSetting the environmentExecuting the migration
    1. Requirements for MultilingualPress 2 to 3 Migration Tool
    In order to perform a migration of your Multisite Network from MLP 2 to the new Version MLP 3, you need:

    An installed version of WordPress Multisite with WordPress 4.8 or above.
    An installed and activated version of MLP 2.
    WP-CLI has to be installed in order to execute the MLP 2 to MLP 3 migration tool via WP-CLI command line. If you need help, follow this tutorial for WP-CLI installation.

    Please note: Before proceeding, we strongly recommend a full backup including all the files and the database of your Multisite Network.
    2. Setting the environment

    Go to: My Sites → Network Admin → Plugins and Update MLP 2 to the latest version (2.11.3 or above) if needed.
    Select the Menu Plugins via Network Admin WordPress Backend
    Download and Install the latest version of MLP 3 (3.2.0 or above). If you need help, see this tutorial.
    Please note: Don』t activate the MLP 3 Plugin yet.

    Download the MultilingualPress 2 to 3 Migration Tool on Github. The latest version of the migration tool can be downloaded from this link: here you find the list of the available releases. Select the latest one (in the example the 0.1.0 is available, but this could be not the latest anymore, so be careful in selecting the latest one) and download the related zip package as specified in the following picture

    An example of the link to use in order to download the package
    Install the MultilingualPress 2 to 3 Migration Tool on WordPress:

    Go to My Sites → Network Admin → Plugins and press the button Add New.
    Select Upload Plugin and upload the Plugin zip file from your computer.
    Press Install Now.
    After installation completed, click Network Activate to activate the plugin across your Multisite environment.

    Go to: My Sites → Network Admin → Plugins and Network Deactivate MLP 2.
    Network Deactivate MLP 2
    Network Activate MLP 3.

     
    3. Executing the migration

    Run the tool via the command line of your system (Windows: cmd.exe; Mac: Terminal) by entering the following instruction:
    wp mlp2to3 all

    The above command will perform all the needed action to achieve the migration from MLP 2 to MLP 3. A process bar will be visible during migration.
    You can also execute only a specific task:
    Refer to the online help to see which tasks are available by using the command:
    wp mlp2to3 --help

    When the migration is completed: Check that the site is working properly and no errors occur.
    Please note: In case of an error, contact our Support.

    If the previous step was successful: Uninstall MLP2 by going to My Sites → Network Admin → Plugins and Delete.
    Network Deactivate and Delete the Migration Plugin.

    How to add icons to the language nav menu items

    How to add icons to the language nav menu items

    How to add icons to the language nav menu items
    This tutorial is part of our MultilingualPress 2 documentation. In case you are using the newer version 3, please switch to MultilingualPress 3.
    By default, our language navigation menus show the language name in its native spelling. This intended: We want to discourage the use of flags for languages. But we do offer the option to use a custom image for each site, and if you want to use that, you can add it to the link text.
    The hook for that is mlp_prepare_nav_menu_item_output. You get two variables as input:

    $item: The nav menu item, an instance of the class WP_Post with some extra properties.
    $translation: An instance of an implementation of the Mlp_Translation_Interface. If we couldn』t find a translation for some reason, this variable is NULL, so you have to test it before you work with it.

    The $translation has a method get_icon_url() which is again an object: an instance of the Mlp_Url_Interface. It can be casted to a string to get the URL. Another way is calling the method __toString() directly. If there is an icon, the escaped URL is returned. You get an empty string otherwise.
    Here is how you can use it:
    /**
    * Adds an icon to the menu text
    *
    * $item is passed as an object handle, so this function can change it directly
    * and doesn't have to return anything.
    * We still return a string value to make unit tests easier.
    *
    * @wp-hook mlp_prepare_nav_menu_item_output
    * @param WP_Post $item
    * @param Mlp_Translation_Interface|NULL $translation Might be NULL
    * if there is no translation for the item or
    * the other site is not linked to the current
    * site.
    * @return string When and why we stopped.
    */
    function mlp_add_icons_to_menu( WP_Post $item, $translation = NULL ) {

    if ( ! is_object( $translation ) )
    return 'no translation object';

    if ( ! class_implements( $translation, 'Mlp_Translation_Interface' ) )
    return 'invalid translation object';

    if ( FALSE !== strpos( $item->title, 'get_icon_url() returns an instance of
    * Mlp_Url_Interface, so we have to cast it to a string
    * before we check it with empty().
    * @see Mlp_Url_Interface
    */
    $icon_url = (string) $translation->get_icon_url();

    if ( empty ( $icon_url ) )
    return 'no icon available';

    $item->title = " $item->title";

    return 'success';
    }

    add_action(
    'mlp_prepare_nav_menu_item_output', // hook
    'mlp_add_icons_to_menu', // callback
    10, // priority
    2 // number of accepted arguments
    );
    Download as plugin: MultilingualPress Addon: Nav Menu Icons. Activate it as a network plugin, and it will just work without further configuration.
    You might have to adjust the image position in your stylesheet. Example:
    .mlp-language-nav-item img {
    vertical-align: middle;
    }
    Here is a screenshot of such a changed menu with our built-in flags. Again: please do not use these flags.
    Always add an alt attribute, but leave its value empty if you still have text, so users with screen readers don』t have to waste their time with it. The item text is good enough.