Magento 2 WordPress Integration Multisite Documentation

  • Installation

    Before installing Multisite, you must upgrade any installed FishPig modules to the latest version.

    You can install the module for Magento 2 using Composer or you can manually install it using FTP.


    Run the following commands in your Magento 2 root directory to install the module using Composer.

    # Add the FishPig Composer repo
    composer config repositories.fishpig composer
    # Install the module using Composer
    composer require fishpig/magento2-wordpress-integration-multisite:*
    # Enable the module in Magento 2
    php bin/magento module:enable FishPig_WordPress_Multisite
    # Run the Magento upgrade system
    php bin/magento setup:upgrade

    You can download the latest version of the module by logging in to your account and selecting Account > Projects.

    Extract the ZIP file and upload the files to your Magento site at the directory below:


    When creating the folders, ensure you use the correct capitalisation.

    To complete the installation, run the following commands in a terminal.

    # Enable the module in Magento 2
    bin/magento module:enable FishPig_WordPress_Multisite
    # Run the Magento upgrade system
    bin/magento setup:upgrade

    ↑ Back to Top

  • Configuration

    For the purposes of this tutorial, we are going to assume that you have installed WordPress in a sub-directory of Magento called 'wp'. If you have used a different directory, you can still follow along but use your directory name in place of wp.

    Activate the WordPress Network

    The first step is to activate the Network features in WordPress. To do this you must first disable all WordPress plugins and change your Home URL to match your SiteURL. To do this, select Settings

    Next, open up the wp/wp-config.php file and find the following line:

    /* That's all, stop editing! Happy blogging. */

    Just above this, add the following:

    /* Multisite */
    define('WP_ALLOW_MULTISITE', true);
    /* That's all, stop editing! Happy blogging. */

    To complete the activation login to the WordPress Admin and select Tools

    Once the installation has finished, you will be given 2 pieces of code. The first piece of code that is supposed to go into your wp/wp-config.php file can be ignored. Instead, open wp/wp-config.php and find the line that you added previously and right below it, add this:

    /* Multisite */
    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', false);
    /* This is required for cookies to work properly */
    define('COOKIEPATH', '/');
    /* That's all, stop editing! Happy blogging. */

    The second piece of code will be for your new .htaccess file but may also be wrong. The correct content for wp/.htaccess file is:

    RewriteEngine On
    RewriteBase /wp/
    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]

    Logout and log back in to the WordPress Admin and the Network should now be fully activated.

    Reconfigure WordPress

    Now that the Network is activated, we can reconfigure WordPress so that the blog is using the correct URL. This is the URL that we changed earlier. We are now going to change it back. Unfortunately WordPress doesn't allow us to do this from the WordPress Admin. Fortunately there are 2 simple ways to do this.

    The first way is to use a tool like phpMyAdmin to change the URL directly in the database. To do this, connect to the DB using phpMyAdmin and find the wp_options table. Search for the record with the key of 'home' and set the value column to the URL we changed earlier (eg.

    The second way is to temporarily add the following code to the very bottom of your wp/wp-config.php file.

    // Change this URL for your correct integrated URL
    update_option('home', '');

    After adding the code, refresh any WordPress Admin page and the URL will be set. You should now remove this code from wp/wp-config.php.

    To check that this has worked, select Network Admin

    While on the settings page, find the Permalinks structure option. If this has /blog/ hardcoded in it, you should remove it and save the changes.

    WordPress should now be reconfigured and your primary blog functioning correctly.

    ↑ Back to Top

  • Add a New Blog

    To add a new blog to your WordPress Network, login to the WordPress Admin and select My Sites

    The first field is the Site Address (URL) field however WordPress will only let you enter the end part of it. For now, enter any character string that is unique to the blog as we e will change this shortly to be the correct URL. For the site title, site language and Admin email, enter the appropriate values and then click Add Site. When the page reloads, select the Edit Site link.

    Site Address (URL)

    On this page we can now edit the full Site Address (URL) field. The correct value for this field depends on how your Magento multistore URLs are setup in Magento. Some multi-stores have a different URL for each store and some have the same URL for each store and use a query string parameter to change the current store.

    Multi-store's Using Different URLs for each Store

    If each store in your Magento website has it's own URL, enter that URL followed by /wp in the Site Address (URL) field. For example, if your second store's URL is, your Site Address (URL) field should be

    Next consider where the URL points to on your webserver. If the URL points to it's own directory and each Magento directory (app, skin etc) is symlinked, yo will also need to symlink the wp folder.

    Multi-Store's Using the Same URL for each Store

    If each store in Magento uses the same URL, your Site Address (URL) field does not need to be changed and should be your Magento base URL followed by a unique character string.

    What ever unique string you choose, you should create a symlink in the wp directory that points back to wp directory. For example, if you chose 'storea' you would create a symlink at wp/storea that points to wp.

    Linking to a Magento Store

    To associate your new blog with a Magento store, login to the Magento Admin and go to the WordPress configuration section in the System configuration. You will then need to change the configuration scope using the store selector in the top left of the screen. Ensure that you change to the Store View level and make the change there.

    Once you are on the correct scope, find the Multisite section and select the correct blog from the dropdown.

    If there are any errors, these will be displayed at the top of the configuration page. Work through each error until a success message is displayed. This will provide the frontend URL for your new blog.

    ↑ Back to Top