WordPress Multisite Administration

By Tyler L. Longren
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies

About this book

WordPress is an incredibly popular blogging platform. Few people realize that the software behind WordPress.com, which is a standalone WordPress with multisite enabled, is available for free, for anyone to make use of. WordPress Multisite is a special “mode” built into WordPress, which allows you to create a network of multiple websites, all running on a single installation of WordPress.

WordPress Multisite Administration is an easy-to-understand book filled with information, tips, and best practices to help you create and manage a blog network similar to http://wordpress.com/, by using WordPress Multisite.

WordPress Multisite Administration will take you through all the steps necessary to get WordPress Multisite installed and configured on your server. It covers everything from installation and initial configuration to customizations and some helpful troubleshooting tips.

You will also learn how to build your own blog directory that features the authors in your WordPress Multisite network. The blog directory is built by making use of WordPress child themes, an incredibly useful thing to know how to do.

You'll learn everything you need to know about running and maintaining a WordPress Multisite installation.

Publication date:
August 2013


Chapter 1. Getting Started with WordPress Multisite

WordPress is an amazing piece of software. One of its more advanced features is called multisite. With WordPress multisite, you can essentially build your own blog network, similar to Wordpress.com or Tumblr.


System requirements and considerations

Multisite is an integrated part of the WordPress core. That means you won't have to download anything other than the official WordPress package to get set up. There are some basic system requirements that you should consider before even trying to install WordPress. At the most basic level, WordPress requires PHP 5.2.4 or greater and MySQL 5.0 or greater. You can see a detailed list of system requirements at http://wordpress.org/about/requirements/.

There are some basic things you should take into consideration before deciding to use WordPress multisite for your project. Most important is defining a project scope and making sure that WordPress provides enough features to meet that scope. It's possible that WordPress is overkill, in terms of features, for your project as well. It's all really dictated by the specific features your project needs.

Chances are, since you're reading this book, you want to set up a blog network of some type. WordPress multisite is used for a wide variety of reasons, from university class blogs to high-traffic websites or anything in between. The most common use of WordPress multisite I've seen is with small groups of individuals who want a blog but don't want to join a massive blog network such as WordPress.com.

WordPress didn't always include the multisite feature. Prior to WordPress 3.0, WordPress came in two flavors, regular and multiuser . WordPress 3.0 introduced WordPress multisite, as it's known today. WordPress 3.0 was released in June 17, 2010.



There are going to be some basic WordPress-related terms that you'll want to become familiar with. These terms usually apply to multisite and a standard WordPress single-site install. You can check some of the terminologies used in WordPress at http://codex.wordpress.org/WordPress_Semantics.

Now that you've got some basic WordPress knowledge, we might as well get to downloading and installing WordPress. The WordPress installation process is very easy, only requiring you to upload the files to your webhost and then to edit database connection settings in a file named wp-config.php.

Before we get too far, we need to take a couple things into consideration. First, think about how you want URLs to be set up. You can use subdomains for each individual's blog URL or you can use a subfolder style setup, such as http://multisite.longren.org/tyler/. Also, installing themes and plugins is a bit different from a typical WordPress install, but we'll get to that a bit later in this chapter. I really suggest reading the Before You Create A Network article in the WordPress Codex, available at http://codex.wordpress.org/Before_You_Create_A_Network.

Okay, let's get down to installing WordPress and enabling the multisite feature.


Installing WordPress

We'll start the WordPress installation wizard with the web browser. I like to use Google Chrome but any web browser should work. So, open your browser and navigate to your multisite installation URL. I installed WordPress multisite at a subdomain of my main longren.org domain name, but you can use a subdirectory too, such as http://www.longren.org/multisite/.

Once you've opened your site you'll see a window as shown in the following screenshot. This is where you can set the name of the site as well as choose your administrative username and password. The default administrative username in WordPress is admin but I highly suggest that you change that to something else. A lot of WordPress web attacks try to exploit the default administrative account name, so not having an admin user puts you in a better position security-wise.

That is the only page where you need to enter any information in the WordPress installation wizard. In the next screenshot, you can see what the page in the previous screenshot should look like after you've filled everything out.


After you've filled everything out and chosen a username anything other than the admin term, click on the Install WordPress button at the bottom of that page. After clicking on Install WordPress, you'll see a Success ! message along with your chosen username. As you can see in the following screenshot, your password isn't shown on the screen:

Once you're on the Success! page, you can click on the Log In button. You'll be taken to your WordPress login page, located at /wp-login.php or http://multisite.longren.org/wp-login.php in my example. You can also navigate to /wp-admin/ or http://multisite.longren.org/wp-ad min/, to log in to your WordPress Dashboard window. The default login page can be seen in the following screenshot. The login screen can be changed visually through the use of plugins or custom settings for your WordPress theme.

Enter the Username and Password values that you chose when going through the WordPress installation wizard to get logged in. Upon successful login, you'll be taken to your WordPress Dashboard window for the first time. Now, we get to do more stuff that's specific to multisite setups. But first, the following screenshot shows what your WordPress Dashboard window should look like:


Configuring the WordPress multisite feature

First, we need to download WordPress. Open your web browser and navigate to http://wordpress.org/download/. At that page you can choose to download WordPress as a ZIP file or as a .tar.gz file. If you're on Windows you'll probably want to download the ZIP file, while Linux and OS X users can download whichever they prefer.

Once you've got the .zip or .tar.gz file downloaded, open it up and you should see a folder named wordpress in there. Extract that wordpress folder to somewhere on your local computer, such as your desktop. Next, open up an FTP connection to your webhost and upload everything from the wordpress directory that we have put on your desktop earlier.

After the upload is finished, go ahead and install WordPress as you would for a single site. After that install is done, we'll edit wp-config.php to enable multisite.

We'll go through the basic settings in wp-config.php, including code snippets.

After renaming wp-config-sample.php to wp-config.php, open it up for editing. You can open it directly from your webhost if you're using a FTP client such as FileZilla. Just right-click on wp-config.php and select View/Edit within FileZilla. I chose to use FileZilla as an example because it's available for multiple operating systems, including Windows, OS X, and Linux.

Once you've opened wp-config.php in your text editor, you'll be presented with some code that looks like what you'll see in the next code.

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'database_name_here');

/** MySQL database username */
define('DB_USER', 'username_here');

/** MySQL database password */
define('DB_PASSWORD', 'password_here');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

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

 * Authentication Unique Keys and Salts.
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 * @since 2.6.0
define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

You may notice that there's an additional piece of code in there, compared to what's being shown in your wp-config.php file. There's a comment in there that says Multisite and directly under it is where we define the named constant, WP_ALLOW_MULTISITE, to true. In the following code, you'll find exactly what you need to add to wp-config.php to enable the multisite feature:

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

I like to set that constant below the database config settings, around lines 36 and 37 in the default wp-config.php file.

The database configuration constants at the top of wp-config.php are pretty self-explanatory. They're named things such as DB_NAME, DB_USER, and DB_PASSWORD. Bet you can guess what those values should be set to. There are some not quite so obvious database settings too, such as DB_CHARSET and DB_COLLATE. It's usually a good idea to keep those at the default value; DB_CHARSET is set to utf8 by default, which is Unicode. The DB_COLLATE constant should contain a value for the language you're going to use within WordPress. If you're using English, you can just leave the value for DB_COLLATE blank.

In the following code, I also included a bunch of named constants for authentication unique keys and salts, towards the bottom. You need to change the existing values there. You can easily generate new, random values by visiting https://api.wordpress.org/secret-key/1.1/salt/. Just copy the eight lines of code generated on that page and then paste it into wp-config.php, replacing the other keys. So you should go from the following code to something resembling what you see in the version generated by api.wordpress.com:

define('AUTH_KEY',         'put your unique phrase here');
define('SECURE_AUTH_KEY',  'put your unique phrase here');
define('LOGGED_IN_KEY',    'put your unique phrase here');
define('NONCE_KEY',        'put your unique phrase here');
define('AUTH_SALT',        'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT',   'put your unique phrase here');
define('NONCE_SALT',       'put your unique phrase here');

And following is the code that's an example of the keys generated on the api.wordpress.com page:

define('AUTH_KEY',         '*`b7,!cuc2Ub+IabKJ-h|*5SdfO8uBm-L1&=<Q5>6oiS3?qCTVA|^d%W(o[<Y-<C');
define('SECURE_AUTH_KEY',  '<v?OP<V*:Nz#AazY0l?*7^{d-i6-EyA*,|Flp>|BR&*u=&Gad{2r6L^8g+#r~Z&^');
define('LOGGED_IN_KEY',    'I!u|T-h(4kc[ L%#QJs7`NyM.]]-W`/,rmhRteNQ`^LC+0>0&zG|6Lqe5Zf%kx$B');
define('NONCE_KEY',        ',[RGlO?&-GDw|>DC&rH5gMQ040(d3Xo{dCAY~F28M=:=]l>/_,|d#l9X_aRTHfnp');
define('AUTH_SALT',        '8G+g,K.Sd^PDyD,[email protected],mcXs&CxqR5veL*z9P%<O|+O2^YU}Ob^je|Ty;{JL1AQOz/');
define('SECURE_AUTH_SALT', 'mndP#V.PZNH+N2HN9,I5`KC_;|j7TyT[`_1UFX 3j|x18*cZSO5`u2j5miB^~d^:'); 
define('LOGGED_IN_SALT',   '[>uO+hz%+0t9X1tf<P*Sx1q44leN_WI4$l>yD-fiu7a>{Gq+ubtqjpym4[S0YPTp');
define('NONCE_SALT',       'O [email protected]{4PAi-*Q+OhVD^[email protected]]Uebrwc}qLW,2tR*1g4+NMF(sbrp>ppoFD [j');

After making those changes to wp-config.php, save the file and upload it back to your server. If you opened wp-config.php directly with FileZilla, you'll be prompted with a window inside FileZilla that's titled File has changed. This window asks if you want to upload the changed file back to the server. Click on Yes and your modified wp-config.php file will be automatically uploaded to its original location on your server. Any additional changes you make to wp-config.php can be uploaded simply by saving wp-config.php again and telling FileZilla to upload your changed file.

Now that our wp-config.php file knows that we're going to set up multisite, it's time to run the network setup. To install a network, start out by putting your mouse cursor over the Tools menu on the left-hand side of the WordPress Dashboard window and clicking on the Network Setup submenu item.

The page you're taken to after clicking on the Network Setup submenu item is titled Create a Network of WordPress Sites. Sounds awesome, right? This is ultimately what we're here for, after all.

From here, you can specify if you want to use a subdomain for individual sites or if you'd rather use a directory. I've chosen to use a directory as I think that's the most common setup. So, the URLs in my example will be http://multisite.longren.org/tyler/ for my blog, http://multisite.longren.org/kayla/ for my wife, Kayla's, and http://multisite.longren.org/sydney/ for my daughter, Sydney's.

The setup I'm using on the Create a Network of WordPress Sites page can be seen in the following screenshot:

Specify your Network Title and Admin E-mail Address values and click on the Install button at the bottom of the form. After clicking on Install you'll see a page with Enabling the Network in bold at the top, with some more named constants being defined also. Copy and paste the code from the section 1 into your wp-config.php file and re-upload it to your server. Next, edit your .htaccess file. It should be in the same folder as wp-config.php. If the .htaccess file doesn't exist, you can save a blank text file as .htaccess and upload it to your server. Copy the Apache rewrite rules from the section 2 into your .htaccess file and upload it to your server, again, in the same directory as the wp-config.php file.

The following screenshot shows the page after clicking on Install; it's the page that provides the sections 1 and 2, that I previously referenced:

After you've uploaded your modified wp-config.php and .htaccess files, the setup of your multisite network is complete. You'll need to log in again, so just click on the Log In link at the very end of the Enabling the Network page. You'll be taken to the login page as shown previously. You may need to clear the cache in your browser and possibly delete cookies for the domain your WordPress site is using.

After you're logged back in, you should see a My Sites link in the WordPress toolbar at the top-left corner of the screen. Put your mouse cursor over it and then click on the Network Admin item. Doing so will take you to the network Dashboard window, which is similar in appearance to the regular WordPress Dashboard window but significantly different in content. This is where you can see the sites hosted by your new network. From here, you can add new sites, new users, or enable and disable themes and plugins. Cool, huh? The following is the screenshot of the network Dashboard window:


Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.



Congratulations! You've created your first WordPress multisite network! Wasn't too bad, was it? In the next chapter, you'll use the knowledge gained here to really put multisite to use. We'll be covering customization, including building out a custom Blog Directory page, with Gravatar support and all.

About the Author

  • Tyler L. Longren

    Tyler L. Longren grew up in Central Iowa and continues to reside and make a living there. He's worked for various employers, from newspapers and commercial kitchens to startups and well-established Internet companies. Tyler has been involved in technology since he was very young and remembers watching his father write software from as early as 2 years old. Tyler was fortunate to attend a primary school where he was able to explore his interests more freely than might have been possible elsewhere. Since 1999, Tyler has been especially interested in web development. He's worked on all types of websites, websites for friends, local companies, and high-traffic niche websites. He's been using WordPress since 2005, back when WordPress required PHP4 and would not work with PHP5. He's also been an avid blogger since 2002 and started with some custom PHP and an old HP Vectra XW machine running Slackware Linux out of his home, with a dedicated phone line for the modem.

    Browse publications by this author
WordPress Multisite Administration
Unlock this book and the full library FREE for 7 days
Start now