[Mini-Tutorial] Magento and WordPress Multisite Integration

Welcome back to the Magento WordPress Integration series!

Check out my other posts from the series:

Today we’ll talk about about running multiple instances of WordPress. Having multiple stores is not unusual in the realm of Magento, in fact you can easily configure one installation of Magento to have different store fronts and that’s one of its many great features we love about the platform. I have been working on a few different Magento projects that use multiple instances of WordPress lately and have found this topic interesting and would like to share my knowledge of a WordPress Multisite Integration. The purpose of using a multiple instance is to target different audiences, for example: each WordPress instance may be for different language groups or they may be targeted to different regions, or different topics, and so on.

I will cover the basics of doing a full integration, but first remember to have Integrate Theme is set to “yes”. To accomplish this you will need their paid multisite extension on top of the free Magento WordPress extension. You can to implement you own solution if you don’t want to pay, but it is not worth the effort since it only costs you for £49.99 and saves you hours of work.

Related: Working with Magento vs WordPress for eCommerce

Step 1:

Add the following to wp-config.php. This enables you create the multiple WordPress websites, and you’ll then see a different control panel in WordPress.

define( 'WP_ALLOW_MULTISITE', true );

define('MULTISITE', true);
//The following trigger whether to use subdomain or subdirectory
define('SUBDOMAIN_INSTALL',false);
define('DOMAIN_CURRENT_SITE', 'www.demacmedia.com');
define('PATH_CURRENT_SITE', '/site1/contents/'); //use the home path of the WordPress config.
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
$base = '/wordpress/';

//This should prevent getting stuck at WordPress login screen
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

The below screenshot show you how the network admin looks. Once you see the network panel, you go to “sites” section. That’s where you’ll create your new site.

Multisite1

SS2

Warning: If you are using sub directory, DO NOT attempt to change website address to something other that what the URL inherited. It breaks admin’s site switcher, that mean you will get stuck at the default site admin panel.

For Example: Let says your default website address is “http://example.com/blog”, the website address for other sites would be “http://example.com/blog/{something}”. If you change the website address to “http://example.com/blog/site2” to “http://example.com/page”, that would not be possible because that breaks the switcher.

After you have set up your WordPress site, you’ll have to go to the setting tab of each site and change the Home URL to match the Home URL you set up in Magento. This is required for Fishpig to route properly.

SS3

Here are 2 examples:

  • if your “HOME URL” setting in Magento is “/content”, your WordPress HOME URL would be “http://example.com/content”
  • if your “HOME URL” setting in Magento is “/content” and you are using store_code (ca_en) in URL, your WordPress HOME URL would be “http://example.com/ca_en/content”

Related: Magento Certified Solution Specialist (MCSS) Study Guide

Step 2:

The next step would be config each WordPress instance to match your need. I’ll skip this part since everyone uses different configuration. You can switch to Magento, once you are done configuring your sites. Install that Multisite plugin and verify that it’s working. All you have to do in Magento is to select the blog in each website/store scope.

SS4

Once that’s done, go to your blog by going to the WordPress Home URL. You should see your blog is now running in your Magento theme.

The following .htaccess change is optional. It bypass Magento routing to directly use WordPress folder.
—– .htaccess —–
#Wordpress handler!!!
RewriteRule ([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) wordpress/$2 [L]

RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
—— End .htaccess —–

WordPress and Magento

That’s it. It’s quite easy! Magento is a great platform that allows users to have multiple sites with one installation. Hopefully my tutorial helped you integrate your WordPress blog with Magento and the Magento theme. When you are theme the blog with Magento template, you usually don’t have worry about WordPress’s website scope. That’s taken care by the Multisite plugin. If you do hit a roadblock, please leave a comment. I’ll try to get back to you as soon as possible.

Related: Understanding Full Page Cache in Magento Enterprise