Getting Started with WordPress Multisite

multisite

What is WordPress Multisite?

With WordPress 3.0 came the ability to create a Network of sites from a single install of WordPress, commonly referred to as WordPress Multisite (MS). The best example of this in action is WordPress.com, the massive WordPress MS install from Automattic.

Although often recommended for creating sites with disconnected content, it is possible to share pages, posts and even custom post types across sites.

How to Setup Multisite

By default, WordPress ships with multisite disabled. To enable the feature you have to add a line of code to your wp-config.php file.

Under the line where it says /* That’s all, stop editing! Happy blogging. */ add the following code:

/* Enable Multisite */
define('WP_ALLOW_MULTISITE', true);

Once you add this save this, go to Tools > Network Setup. From there you can decide whether you want to use subdomains for your site URLs or subdirectories.

  • Sub-domains: site1.domain.com, site2.domain.com, site3.domain.com
  • Sub-directories: domain.com/site1, domain.com/site2, domain.com/site3

It is possible, using a plugin like WordPress MU Domain Mapping, to use different domain names for the different sites. This process does require some more advanced knowledge of WordPress as well as working with servers.

Once you choose your URL method of choice you will have to make one more round of updates:

  1. Create a blog.dir folder in your wp-content directory and make writable
  2. Add the provided code into your wp-config.php file. Change where it says ‘wpms-demo.com’ to the url for your main site.
    /*
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
  3. Replace your .htacess file code with following code.
    /*
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'wpms-demo.com');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE', 1);

From here you will have access to the My Sites menu in the top admin bar. To add a new site go to My Sites > Network Admin > Sites and click on Add New.

To create a new site just enter in the url for the site, either sub-domain or sub-directory, the site title and an email address for the site admin (can be the email of an existing user).

If public registration for new sites is enabled under Network Admin > Settings > Network Settings, users can also sign up new sites by going to yourdomain.com /wp-signup.php.

If you plan to let people create new sites, look into a plugin like Multisite User Registration Manager.

For more detailed information on the WordPress multisite setup process and adding new sites, see the Create a Network article on the WordPress.org codex.

How Plugins and Themes work with Multisites

Individual sites cannot install their own themes and plugins directly. They must be installed at a global level. Once installed, a plugin or theme is available to all networked sites. An additional option lets you activate a plugin across all sites.

Sites can pick their own themes, but cannot edit the theme template files on a per site basis. When theme templates are edited they apply across all sites. Only network admins have the theme editor option available in the admin area.

Although all themes should technically work for MS, you may want to look for themes specifically designed and tested for Multisite. When you’re looking for plugins, you will want to make sure that they work with MS. There are also some plugins designed specifically for managing and improving MS sites, like these and these, that you will want to familiarize yourself with.

Two powerful plugins for WordPress MS are BuddyPress and bbPress from Automattic. BuddyPress adds powerful social networking features to a Multisite install. You should definitely look into it if you want social networking features on your Network. bbPress is a WordPress Forum plugin that will let you create forums on your individual sites on the Network.

Managing a Multisite Installation

There is a big difference between managing a single WP install and a MS install. Some things you may want to keep in mind:

  • Make sure you have a powerful enough server for the number of blogs you plan to host
  • Be careful with granting admin rights and always make sure you’re in the dashboard for the correct site when logged into the admin area
  • Test plugins to make sure they are compatible with MS
  • Keep on top of new sites created and the general traffic and user interaction patterns across sites to the extent possible
  • Take the time to setup a caching plugin like W3 Total Cache
  • Make sure to regularly backup your sites using a service like ValutPress or a backup plugin

Further Resources

For some more advanced tips, check out Wes Chyrchel’s slide deck on Multisite Tips, Tricks and Hacks.

Accessing if Multisite is right http://codex.wordpress.org/Before_You_Create_A_Network
Setting it up http://codex.wordpress.org/Create_A_Network
WordPress Mulitsite on MAMP http://perishablepress.com/wordpress-multisite-subdomains-mamp/
More advanced tips http://codex.wordpress.org/Multisite_Network_Administration

Some recommended plugins:
http://wordpress.org/extend/plugins/network-shared-media/
http://wordpress.org/extend/plugins/mu-manage-comments-plugin/

Free Workshops

Watch one of our expert, full-length teaching videos. Choose from HTML, CSS or WordPress.

Start Learning

Zac Gordon

Zac is the WordPress teacher at Treehouse. Before coming to Treehouse, Zac taught web design and development at the high school and then college level. In addition to teaching web design, he owns a web design company and teaches Yoga.

Comments

Comments are closed.