Professional Documents
Culture Documents
4th Edition
Copyright
2012-2013 Mika Ariela Epstein This ebook is released under a Creative Commons AttributionNoncommercial-ShareAlike license, which lets you share it, remix it, and share your remixes, provided that you do so on a noncommercial basis. You can give it away, but please dont sell it. Putting it up on your website where you have ads, or using it in your class is fine. Putting it behind a paywall is not. http://creativecommons.org/licenses/by-nc-sa/3.0 WordPress Multisite 101 http://halfelf.org/ebooks/wordpress-multisite-101/ While this ebook is provided free of charge, you are encouraged to pay what you feel this book is worth. A suggested donation of $6 can be made at PayPal or WePay:
https://www.paypal.com/cgi-bin/webscr?cmd=_sxclick&hosted_button_id=3ZUMMSVVCXEMA https://www.wepay.com/donations/ebook-wp-multisite-101
Code Licensing
All code samples, examples, snippets or otherwise on this blog are, unless explicitly otherwise noted, licensed under an GPL2 (or later) license:
This software is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This plugin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Acknowledgements
This book wouldnt be possible without a very patient family, but also without WordPress itself. Without the amazing variety of configurations found on the WordPress forums, IRC and email list, as well as the hundreds of people whove just had one, odd little question, this information might have been lost forever.
Introduction
................................................................................10 What Is Multisite?
.......................................................................12 When You Install WordPress...
...................................................14 Before You Activate Multisite
.....................................................16 Creating A Network
...................................................................19
Allow Multisite
....................................................................................................19 Enabling the Network
.........................................................................................20
FAQ
............................................................................................46
Where are my sites? I dont see them on my server!
...........................................46 Where are my images?
........................................................................................46 All my images upload to les, but theres no les folder!
....................................46 Can I make an existing site into a Multisite?
......................................................47 Why is the theme not working on my subsite? ....................................................
47
How big is my database going to get? .................................................................47 How big is my server going to get? .....................................................................48 Will Multisite make my server slower? ................................................................48 How do I know which plugins are safe to use on Multisite? ...............................48 Can I install Multisite in a subfolder? .................................................................48 Can I use giving WordPress its own directory with Multisite? .........................48 Can I make all my sites use the same media library? .........................................48 Can I make all my sites use the same content? ...................................................49 I need more help! Where can I go? ....................................................................49
Introduction
WordPress is a well known blogging/CMS web application, popular for its ease of use. Once a user gets over the initial hurdle of mastering a new tool, they can configure a site in a dizzying array of ways. This eBook is intended to help you install WordPress, configure Multisite, and map domains on a Linux server running Apache. If youve never installed WordPress before, there will be some hurdles along the way, as Multisite is notably more complicated than running a single, stand alone, WordPress instance. We will not be discussing how to install WordPress, nor how to find a host, set up a database or any other basic webmastering skills. If you have never attempted to run a website before, Multisite is like trying to master the high dive and learn to swim at the same time. You can do it, but youre making things very hard for yourself. Furthermore, this book will not delve into wether or not you should use Multisite. No one can really answer that question for you, so you should take the time to research what Multisite is and is not before you start.
Prerequisites
For this book to be useful, you should already have mastered (or become familiar with) the following: 1. You already know how to install WordPress. If youre starting from complete zero and know nothing about how to install WordPress, start with that and then come back to Multisite. 2. You already know how to access the files on your server. Be it via SFTP or SSH or even a File Manager on your hosts control panel, you must know how to edit the files on your server. 3. You know how to access your database. WordPress uses a database to store the content of your posts, as well as plugin settings and other site specific variables. If you dont have
access to the database, via a tool like phpMyAdmin, you will have issues debugging. 4. Youre not afraid to open up files and look at them or edit them. One of the troubleshooting techniques this document will touch on requires you to be able to open up the WordPress files and edit them. 5. Familiarity with your servers error logs. A good webhost can help in this respect, but knowing where the error log is will be invaluable. If you dont know, you can always ask them. 6. You know how to turn off all plugins, and use the default theme. The first step of WordPress troubleshooting is to do that. If you cant (or wont), there will be complications.
Chapter 1
What Is Multisite?
As of the release of WordPress 3.0 (17 June, 2010), WordPress has included a new feature known as Multisite. Formerly, Multisite was separate product called WordPress Multisite or WPMU for short. The two were integrated and now allow users to seamlessly transition from running one WordPress install to many, without having to install multiple instances of WordPress! Multisite allows you to create additional blogs off your main install, either as subdomains or subfolders. We call this a Network and the blogs are referred to as Sites. When you use Multisite, there is one install of all your themes and plugins, as well as only one database. A WordPress Network is best thought of as a way to maintain multiple separate sites. Each site exists in its own bubble, with users, plugins, and themes all configured per-site. While it is possible to share content, this is considered an advanced feature. For a good example of what a WordPress network looks like, go check out http://wordpress.com - They have multiple separate sites, all named example.wordpress.com or via a mapped domain. Each site is separate, with its own users, design, etc. When you use Multisite, the out-of-thebox settings will create sites similarly. While code is shared between sites, configurations are not.
Special Terms
For those familiar with WordPress, there are a few additional terms that are used with Multisite. Super Admin - A super admin, also known as the Network Admin, is a user who has access to the entire network, can add and delete sites and users, install themes and plugins, and basically do whatever they want. This access is automatically granted to the account you specify when you activate Multisite. While you can add others later, you should be very careful with whom you permit this access.
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 12 of 61
Network - The network refers to your collection of sites. Sites - A site is a blog, though as you dont have to have your site act like a blog, WordPress uses the more generic term here. Main Site - Your main site is the first one you installed, normally found at http://example.com and, in the database, has the ID of 1. Sub Sites - All additional sites on your network will be referred to as sub sites, regardless of if you are using subdomains or subfolders.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 13 of 61
Chapter 2
If you install in a directory and run it from root, congure it before you turn on Multisite
One of the most popular things to do is to install WordPress in a folder off of the HTML root - for example in /public_html/wordpress/ - but use the forward facing URL of http://example.com instead. 1 As of WordPress 3.5, you can do with with Multisite. Simply install WordPress in the subfolder and set it up to run from root before you create your subsites. If you decide to do this after the fact, it can be done, but youll need to manually edit your database.
The default option is to use the prefix of wp_ which works just fine. Naming your prefix wp1_ or, worse, wp1 (without an underscore) will cause conflicts with the numbering structure WordPress uses for per-site tables.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 14 of 61
Before you turn on Multisite, make sure you can use Pretty Permalinks. This essentially tests your servers ability to use mod_rewrite, which is that cool thing that translates URLs from http://example.com/?p=1 to http://example.com/hello-world/ Simply put, if pretty permalinks dont work, Multisite will never work.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 15 of 61
Chapter 3
Subdomains vs Subfolders
A subdomain install means that your sites will look like this: Main site: Sub Site #1: Sub Site #2: Main site: Sub Site #1: Sub Site #2: http://example.com/ http://site1.example.com/ http://site2.example.com/ http://example.com/ http://example.com/site1/ http://example.com/site2/
In addition, if you use a subfolder install, the post URLs on your main site will have the slug /blog/ prepended to them, causing them to look like this: http://example.com/blog/2012/03/hello-world/ At this time, you cannot easily customize that slug or remove it. There is no SEO benefit to using subdomains or subfolders, and you can map a domain name to either install, so the decision is purely cosmetic.2
Wildcard Subdomains
If you want to use subdomains, most people suggest activating Wildcard subdomains if at all possible. This will allow you to create a new subdomain site and have it automatically function without any manual
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 16 of 61
intervention. You can still manually create subdomains if you want, of course. There are two steps that need to be completed for this to work.3 First up, in Apache, there needs to be a line in the domains virtual hosts section as follows: ServerName yourdomain.com ServerAlias yourdomain.com *.yourdomain.com DocumentRoot /home/yourdomain/public_html/ ServerAdmin webmaster@yourdomain.com The Server Alias line with the *.yourdomain.com is what controls this. If you do not have access to change this, ask your webhost for support. More and more hosts are enabling this by default. Second, you must make sure your DNS record is correctly configured for wildcard subdomains. Most are, by default, however you may need to add in a line like this: *. IN A YOURIPADDRESS
That will redirect all requests back to your main install. If youre using cPanel (a popular control panel for webhosts), its generally as simple as making a subdomain named *
This takes care of both the DNS and the Virtual Host.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 17 of 61
If youre using Plesk, it gets a little more complicated, and you should ask your webhost for help.
Restrictions
To expand a little on the previous chapter, there are specific situations in which you cannot create a network. When you install Multisite, you start with a basic WordPress install. With a fresh install on its own domain, there are few additional concerns, however sometimes people want to install a test Multisite on their localhost. When you do that, there are some additional concerns. You cannot create a network in the following cases: "WordPress address (URL)" uses a port number other than ':80', ': 443'. In addition, you cannot choose subdomains in the following cases: The WordPress URL contains a path, not just a domain. (That is, WordPress is not installed in a document root, or you are not using the URL of that document root.) "WordPress address (URL)" is localhost. "WordPress address (URL)" is IP address such as 127.0.0.1. It is possible to switch between subdomain and subfolder installs at a later date, however you will need to be comfortable with editing your database to do so, and its not recommended.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 18 of 61
Chapter 4
Creating A Network
Now were ready to go!
ALLOW MULTISITE
To enable the Network Setup menu item, you must first define multisite in the wp-config.php file. Open up wp-config.php and add this line above where it says /* That's all, stop editing! Happy blogging. */ If it doesn't say that anywhere, then add the line somewhere above the first line that begins with require or include: define('WP_ALLOW_MULTISITE',true); It should look something like this:
Network Setup
Look under Tools where youll see a new menu item called Network Setup.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 19 of 61
Go to that screen and you will be greeted by a welcome message and a few questions. If, at this point, you still have www in your domain name, its the time to go back, remove that line from your config and then go back and edit the site and home URLs.
Select the type of network you want. Then review the Network Details section
Make sure you put the email of your admin user for the email address. This user will become the Super Admin and have superuser access to the entire network. This is different than a site admin, but well get to that a little later on. Once you press save, youll be brought to a new screen with three steps.
Youll need to add these lines to your wp-config.php, right below where you added that first line. Do not delete that first line! It looks a lot like the first line in the new section, but its not the same! define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); $base = '/'; define('DOMAIN_CURRENT_SITE', 'example.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); Youll notice that true is bolded. If youre using subdomains, this is true. If youre not, that will be false. Remember, that is an example of the output, yours may be different. Always copy from what your WordPress install has.
There are two main versions of .htaccess for Multisite, depending on if you chose subfolders or subdomains. Since youve tested your pretty permalinks already before turning on Multisite, your .htaccess should contain this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 21 of 61
If it does, delete it. If you have anything else in your .htaccess you can keep it, but make sure to remove the old WordPress lines, and put these new ones in at the very bottom of your .htaccess le. Remember, WordPresss calls always go on the bottom!
Reboot
Once youve done all that, log out of WordPress and then log back in. You may need to clear your browsers cache to make things work. Once you log back in, you should see the new My Sites menu on the toolbar.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 22 of 61
Chapter 5
Very similar to the normal dashboard, the Right Now section lists how many users and sites you have, with handy links to create new ones. Well get to that in a minute. Network settings has the majority of the basic configuration youll want to edit. You can get there by going to the Settings menu, and opening Network Settings.
You may hear the Super Admin referred to as the Network Admin or Super Grover or even Cape Wearing Users - They all mean the same thing.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 23 of 61
Theres quite a bit of information on this page, and much of it can be confusing. Some of the settings require familiarity with how servers are designed, while others are very obvious. Well take them by the numbers.
OPERATIONAL SETTINGS
These settings are pretty obvious. You can change the Super Admin email to anything you want, but make sure it really does exist.
Registration Settings
There are multiple settings in this section. An important point to remember is that users are network wide. Once created, they have the potential to be added to any site on the network. Naturally theyre not all given that access, though they can be. This is why, when you add a new user, they dont show up on a site right away. You have to add them to the network, then to the site (unless you use a plugin, see the advanced section).
By default, no one can register. The settings are fairly obvious. People can either not register, register for accounts, get an account and then make a site, or be able to create an account and a site at the same time.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 24 of 61
WordPress.com allows users to create both sites and user accounts at the same time. This does not mean you should do the same thing! Allowing anyone under the sun to register and make a site on your network can be risky if youre not prepared to support all those people. Remember, what they post on your site is your responsibility, and if they break the law, or bring the ire of someone on them, you pay the price. Be responsible.
Registration Notication
This ones straight forward. The email goes to the address listed in Super Admin Email. You cant change this without activating the new email (youll get an email asking you to do this).
If checked, admins of sites can add new users to the network and their sites. Otherwise, they can only add users that already exist on the network to their sites.
Banned Names
The listed names cannot be used for user names or blog names. You really dont want to remove the ones listed, but adding to them is fine.
You can restrict your site so only the domains listed can join your site. This is particularly useful if youre running a site for a school or a company. Just put example.edu or example.com in the box.
All the options in this section will help you customize what new sites on your network look like. Make special note of any constants like SITE_NAME or USERNAME. These are special variables used by WordPress, and deleting them will make it hard to recover. These settings mimic the defaults that you see on a normal WordPress install.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 25 of 61
Welcome Email is what the new site admin receives when their site is created. Welcome User Email is what new users added to the site receive First Post is the first post, commonly known as Hello World. First Page is the first static page, usually used as an About page. First Comment is the sample comment left, to show what comments look like. First Comment Author is the name of the comment author. First Comment URL is the URL, if you want one.
UPLOAD SETTINGS
These settings can limit the upload abilities of subsites. If you intend to upload large files like videos, you will need to change the settings accordingly. If you want to keep the defaults low, but customize individual sites, you can do that in another section
Bear in mind, changing the le types you allow here does not automatically permit WordPress to upload them. Youll need to make an MU Plugin to handle that (which well get to later).
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 26 of 61
Chapter 6
Managing Sites
Sites can only be created with characters a-z and 0-9. While a Super Admin can go in and add other characters (like underscores or hyphens) later, its suggested this be avoided, especially if youre using subdomains. Not all servers support non-alphanumeric characters in subdomains.
Adding a new site as the admin is simple. From the Super Admin dashboard, you can either click on the Create a New Site link or go to the Sites menu and click on Add New. Either will bring you to a new screen called Add New Site.
Simply enter in the information and a new site will be created. As the Network Admin, you will be able to use any character, and not just a-z and 0-9.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 27 of 61
LISTING SITES
Your sites will be listed on the Sites menu under the listing Sites and will appear thusly:
You can also get a list of sites off the toolbar, however these will only show sites that your ID is an administrator of. If you create a site and make another user the site admin, you will not see it listed in the toolbar.
Edit will take you to a screen where you can change site options. Dashboard takes you to the normal wp-admin dashboard. Deactivate and Archive both close the site and prevent non logged in users from seeing it. Spam marks a site as spam and locks it. Delete removes the site and all its content from the database. Visit goes to the site URL.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 28 of 61
Edit
The Site Edit feature is where you can can customize settings normally found on the Settings menu of the Dashboard. There are four main sections.
Info
The basic site information, like domain, path, registration date, and status are found here. While it is possible to change a site name in this section, doing so on an existing site can have a dramatic outcome if you change the length of the site name.
Its in this section you can add non-alphanumeric characters, however do so with caution, for the reasons mentioned earlier.
Users
The users tab lists all users on the site. Well talk more about how to add users later. Suffice to say, if you have users on the network and wish to add or remove them to the site, you can do so here.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 29 of 61
Themes
The themes tab lists all the themes installed on the network. If theyre greyed out, they are currently not available to this site. This will be explained in more detail in the themes section.
Settings
The settings tab is a highly advanced section that the vast majority of you will never need to edit. That said, its often easier to go here and make changes than it is to poke around the dashboard of each site to make adjustments. Also, there are a few settings users expect to see on a normal admin dashboard, like the media settings where they can change the file upload directory, that simply dont show on Multisite. The reason is that with a Multisite, youre using shared space. Its much easier to support users if everyone has the same setup. Also, the normal admin users dont generally have access to create new directories on the server, so you, as the Super Admin, must create the folders and make the appropriate changes. The one setting most people will need to update is at the very bottom - Site Upload Space Quota - which can be changed to allocate more or less disk space on a per-site basis. Everything in this section makes a direct edit to your database. Edit with extreme caution, and if youre not sure, ask for help or leave it alone.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 30 of 61
Chapter 7
Managing Users
By default, users are added to the Network, not an individual site. This causes much confusion with users, as they think theyve signed up for a site, but instead they have to be added. Also, unlike a single site install, you must use only lowercase letters. This is because, when users are permitted to create a user account and site together, the default path of the site matches their user name. For example, if a user logged in and requested the username of foobar, they would be prompted to create a site with the URL http://example.com/ foobar If permitted, users can register to the network themselves. Otherwise you will need to add them. Site Admins can always add existing users to their sites, but they cannot add new users to the network unless that setting is checked in Super Admin > Settings. Users who do not belong to any site are still able to log in to the network, but they only have access to the special user dashboard and profile: http://example.com/wp-admin/user/ . Here they can edit their profile, which is network wide.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 31 of 61
Go to Super Admin > Users > All Sites to edit the site. Click on the users tab and add new user:
Go to the dashboard of the site and go to Users > Add New. Fill in the form for Add New User.
Note: This is the only location where you can add a user and not email them a notification.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 32 of 61
If a user already exists on the network, either having registered themselves or by you, you will still need to add them to a site. Go to Super Admin > Users > All Sites to edit the site. Click on the users tab and add the user:
Select the role the user should have and hit save.
This is only available to Super Admins, unless youve checked Add New Users in the Network Settings section:
By default this is not checked. If it is, the site admin can go to their Dashboard and visit Users > Add User, and fill in the form for Add New User.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 33 of 61
Again, this is the only location where a user can be added without sending a notification email.
As a Super Admin you have access to do anything, from installing plugins and themes, to added and deleting users and sites. This is different than being the administrator of a site on the network. A site admin only has access to make changes on their own site. Because of the elevated permissions a Super Admin has, you should only give this access to people you trust completely. In order to make a user a Super Admin, go to Network Dashboard > Users and click on edit for the user. On that page, you will see an option under Username that says Super Admin. Check the box and click save.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 34 of 61
You can remove access the same way, from all users except your own. If there is only one Super Admin, access cannot be removed, which is a good thing!
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 35 of 61
Chapter 8
Managing Plugins
Unless youve enabled the plugins menu in Site Settings, site admins will not be able to see which plugins are installed, nor will they be able to activate or deactivate plugins.
Plugins are installed in the same location as a regular WordPress install, and are available for use on all sites. Only the super admin may install plugins, in order to prevent an ignorant or malicious user from crashing your network. If the menu is available, site admins will see all inactive or per-site activated plugins.
INSTALLING PLUGINS
Plugins can be installed via FTP/SSH or using the plugin administration page on Super Admin > Plugins > Add New. The screens are identical to that of the normal WordPress install save the last. Once the plugin is installed, you are given the option to Network Activate instead of simply activate.
ACTIVATING PLUGINS
There are two ways to activate plugins. You can Network Activate or you can activate per site. If the plugin admin menu is disabled, only the Super Admin can activate per-site, and you will need to visiting each site to do it. Network Activating a plugin forces it to on on all sites in your network. Doing so will make it invisible to all site admins, and the plugin will not be shown on their active plugins list.
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 36 of 61
Activating a plugin per-site simply means that the site was activated via the sites dashboard in the Plugins menu. This can be done by a Super Administrator or, if permitted, the site admins.
This is a complicated question. For the most part, any well-written plugin will function regardless of if its activated per-site or network wide. Certain plugins are only able to be activated on the network, and those will not permit you to activate them per-site. Other plugins will recommend you activate per-site. Always read the plugin documentation fully before activating. In general, you should only use the Must-Use Plugins location if directed to do so by the plugin author. Should the plugin not function correctly when network activated, deactivate it and try using it per-site.
DELETING PLUGINS
Generally, you can delete plugins the same way you added them, via the Super Admin. The caveat is that if a plugin was activated per-site on
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 37 of 61
the main site of your network, youll have to go deactivate it first, and then delete. If the plugin was network activating, or active on any other site, it can be deleted.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 38 of 61
Chapter 9
Managing Themes
Themes, like plugins, are only able to be installed on the Network dashboard, under the Themes menu.
INSTALLING THEMES
Themes can be installed via FTP/SSH or using the plugin administration page on Super Admin > Themes > Add New. The screens are identical to that of the normal WordPress install save the last. Once the plugin is installed, you are given the option to Network Enable instead of simply enable.
Network Enabling a theme will make it available for use on all sites in your network. When you look at the Installed Themes on your Network Dashboard, you will see the ones that are network enabled in light grey, while the disabled ones are in dark grey. On an individual site dashboard, all Network Enabled themes are displayed as installed themes.
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 39 of 61
To enable or disable, simply click on the Network Enable or Network Disable links. Disabling a theme will not remove it from any site thats currently using the theme. The theme will remain active on those sites, but they wont be able to change back to it, should they switch to a different theme.
If you have a theme you want to enable for only one site, you will have to go to the Network Dashboard, click on All Sites and edit the site. From there, go to the Themes tab. There you will see any non-network enabled theme. Click on Enable and the theme will be available on that site.
The WordPress default theme (currently Twenty Eleven) is the default theme for all sites. This can be changed to any theme you have installed on your server by editing the wp-config.php file. Add this line below your Multisite section in that file:
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 40 of 61
define('WP_DEFAULT_THEME', 'classic'); Where classic is the folder name of your new default theme.5
DELETING THEMES
You can delete themes the same way you added them, via the Super Admin. If you delete a theme thats in use, any site that was using that theme will display a blank white page to all visitors, until someone changes the theme in either the site dashboard or the network dashboard. For this reason, its considered a bad idea to delete an active theme.
EDITING THEMES
Only the super admin can edit themes, and this is done via the Network Dashboard, under Themes > Edit Themes Remember, when you edit a themes core files, you edit them for all sites on your network. If admins of other sites need to edit their theme, you may need to install a CSS editor plugin such as the one found in Jetpack - http:// wordpress.org/extend/plugins/jetpack/ - bear in mind, Jetpack requires a connection to WordPress.com that must be generated on each site of your network. The following plugins also purport to provide the same feature: http://wordpress.org/extend/plugins/pc-custom-css/ http://wordpress.org/extend/plugins/my-custom-css/ http://wordpress.org/extend/plugins/custom-css-manager-plugin/
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 41 of 61
Chapter 10
Provided you allow for user registration, visitors can go to http:// example.com/wp-signup.php and register for a new account.
They will be emailed their password, and cannot access the site without activating their account.
You cannot activate an account for a user, even as a super admin, so if they dont get the email, or dont reply, it can get messy, as the only way to purge out the activations is through the database.
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 42 of 61
If you allow users to create an account and a blog at the same time (called Open Registration) the form includes the following option:
If you have a subdomain install, going to http://fakesub.example.com will send you to http://example.com/wp-signup.php?new=fakesub and allow them to register, with an additional note:
If the user is creating a new site when they register, they have the option to click on Gimme a site! when they pick their user name. By default, the user name is filled in as the blog name, but that can be changed. Simply fill in the form and click Signup. for the site to be created.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 43 of 61
If the user is creating a site after they made an account, they simply go back to http://example.com/wp-signup.php and fill in this form:
This form is also what you see if you want to create additional sites. There are no default limits to how many sites a user can make, but you can limit them via plugins.
When you run your own single install of WordPress, youre actually the Super Admin of your site! When youre a site admin, you have slightly fewer powers. Its easier to explain what you cant do as a Site Admin: You cant change the URL of your site. You cant move the location of media files. You cant use embed codes for videos6 You cant post by email.
6
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 44 of 61
You cant install plugins or themes. You cant edit plugins or themes. As you can see, there are limitations, however most of these cause no issues to your site admins.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 45 of 61
Chapter 11
FAQ
Before we get to the advanced topics, lets take a moment to go over the most common questions.
How does that work? In your .htaccess theres a line like this: RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wpincludes/ms-files.php?file=$2 [L] That line says Any URL that goes to /files/ should be redirected to /wp-includes/ms-files.php instead And its that file which detects what site youre coming from, where the image actually is, and outputs it for your visitors. By the way, dont make a folder (or file, or page) named files or youll break the redirect magic.
That depends on how you look at it. For every site you create on your network, you will have, minimum, nine new tables created. That can add
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 47 of 61
up pretty fast, especially if you have open registration. Normally, however, this isnt a problem, as most sites are relatively small.
Depends on how many images people upload, and how big they are. But yeah, that can get big too.
Indirectly. See, the more sites you have on your server, the more traffic you have. The more traffic, the slower the server, unless you optimize it. There are minification and caching plugins that can help, but also sitting down and tuning your server will help exponentially.
As of WordPress 3.5, yes you can. If you want to install in http:// example.com/wordpress but have your main site use the URL http:// example.com then just install it like you normally would in that case and set up the own directory before Multisite. Otherwise you have to move Multisite, and thats not really easy. In fact, its so much not easy that doing it wont be explained in this ebook.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 48 of 61
Not out of the box, no. While there are plugins that claim to do this, there are some serious concerns you should be aware of before you do this. First of all, do you really need to share all your media amongst all sites? Certainly if youre working on a design aspect that uses an image, you should have it shared, but generally thats the bailiwick of the theme or plugin youre using. Secondly, if your multisite is open, do you really want all users sharing all media? Still want to? Okay. http://wordpress.org/extend/plugins/network-shared-media/
http://wordpress.org/support/forum/multisite/
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 49 of 61
Chapter 12
Advanced Topics
If youve gotten this far, youre ready to run a network! As with all things, there are some more advanced topics. From this point on, you will have to be comfortable with managing the files on your server and accessing the database. Many of these topics will use plugins, as well.
After all that, sometimes people realize that they didnt want Multisite. It can be removed fairly painlessly.7 1. Delete any extra sites you may have created, either moving the content and users to the main blog or wherever you desire. One the sites are deleted, you cannot retrieve the content. 2. Remove the lines added in the wp-config.php file. 3. Restore the .htaccess file to the default (you can usually restore these by resaving the permalinks). 4. Remove the wp-content/blogs.dir (dont worry, your main site stored everything in wp-content/uploads). 5. Drop these global tables from the database: wp_blogs wp_blog_versions wp_registration_log wp_signups wp_site wp_sitemeta Thats it!
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 50 of 61
EXPORTING A SITE
If you want to export one site from the network and install somewhere else, you will have to make a couple important decisions. If all you care about is the content, a traditional WordPress export will be just fine.8 You can simply import the content on the new location, be it a separate install of WordPress, or just a different site on your network.9 If you need to keep the look and feel of your site, all the plugins, theme settings, and users who dont have their own posts, its vastly more complicated. The basic steps would be to: 1. Install WordPress in the new location. 2. On the existing site, make a note of all users on the site and their user ID. 3. Create your authors (their passwords will change, everyone will have to cope) 4. Export all the wp_x_[tables] from your database, where x is the site ID. 5. Rename the tables in that export file to just wp_[table] 6. Search the export file for the old site URL (i.e. http:// example.com/sitename/ ) and replace with the new one (i.e. http://newexample.com ) 7. Make a list of all the users and their IDs. Compare this to the list you made in step 2 and make sure you know everyones old and new user ID. 8. Edit the wp_posts values for post_author , changing accordingly based on the table you made in step 7. 9. Import the database. 10.Copy /wp-content/blogs.dir/ID/files/ from the old server, and place it in /files/ on your new server.
8 9
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 51 of 61
If at all possible, just use the traditional export/import. Youll get a much cleaner database in the end.
Moving a network from one server to another, provided none of the URLs are changing, is as simple as copying over the database and all the files. If, instead, you are changing domains, then the best way to move Multisite is to move the files, edit the .htaccess and wp-config.php (if the folder name containing Multisite changed), and then manually edit the database. Search for all instances of your domain name, and change them as needed. This step cannot yet be easily automated. It's safe to search/ replace any of the wp_x_posts tables, however do not attempt blanket search/replace without a special search and replace script. You can get a copy of the Search and Replace Script at http:// interconnectit.com/124/search-and-replace-for-wordpress-databases/ If you're moving Multisite from one folder to another, you will need to make sure you edit the wp_blogs entries to change the folder name correctly. You should manually review both wp_site and wp_blogs regardless, to ensure all sites were changed correctly. Also manually review all the wp_x_options tables and look for three fields and edit as needed: home siteurl fileupload_url If you are moving from subdomains to subfolders, or vice-versa, remember to adjust the .htaccess file and the value for SUBDOMAIN_INSTALL in your wp-config.php file accordingly.
will be the only one who decides what filetypes are allow and what ones are not. Of course, if you trust all your site admins, then using a plugin that allows each one to change their filetypes individually is just fine. <?php /* Plugin Name: Allow More Filetypes Description: Allow additional file types to be uploaded by WordPress. */ add_filter('upload_mimes', 'add_custom_upload_mimes'); function add_custom_upload_mimes($existing_mimes){ $existing_mimes['epub'] = 'application/epub +zip'; //allow epub files $existing_mimes['webm'] = 'video/webm'; //allow epub file return $existing_mimes; }
PRE-CONFIGURING PLUGINS
By default, plugins are either on or off, and the settings are handled per-site. In some cases, you want to pre-configure plugins for your users. These days, a lot of plugins are adding Network Management screens to make this easier for you, but when they don't, you need to use a plugin. The following plugins allow you to pre-configure other plugins' settings for your network: http://wordpress.org/extend/plugins/yd-wpmu-sitewide-options/ http://wordpress.org/extend/plugins/multisite-plugin-manager/
RESTRICTING PLUGINS
If a plugin is not network activated, its available for all sites to activate as they chose. Sometimes you dont want this, but instead want
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 53 of 61
to limit certain plugins to only be run on certain sites. There are multiple plugins that can be used for this, depending on how you want to manage plugins. Restrict Multisite Plugins provides an interface similar to how the themes section looks. http://wordpress.org/extend/plugins/restrict-multisite-plugins/ Multisite Plugin Manager allows you to manage plugin activation. http://wordpress.org/extend/plugins/multisite-plugin-manager/
By default, WordPress Multisite has your users segregated per-site. This may not be exactly what you want, especially if youre running a BuddyPress social network. The following plugins allow you to do that in different ways. Network Manage Users lets you mange all users and their sites from the network admin dashboard. http://wordpress.org/extend/plugins/bulk-user-management/ Multisite User Management lets you add users to sites automatically and can be set up differently per site. http://wordpress.org/extend/plugins/multisite-user-management/ Join My Multisite gives each site admin the ability to decide how they want to add new users (or allow new users to add themselves). http://wordpress.org/extend/plugins/join-my-multisite/
MAPPING DOMAINS
You can run multiple domains from one Multisite, by using a domain mapping plugin. You will need to create a site for each domain, but once thats done, its fairly simple to map the domain. The plugin WordPress MU Domain Mapping is very reliable. http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 54 of 61
The complicated aspect of mapping a domain is in mapping the domain to your server. The basic step is to point the DNS settings of your new domain to your existing server. However, depending on your host, you may also have to park the domain in order to add it to your own DNS server. If youve never parked a domain, or made an add-on, you should check with your webhost first. Once youve sorted out mapping the domain, you can point it to your site ahead of time, and verify it works by going to http:// newdomain.com, which should take you right back to http:// example.com/ From the Domain Mapping menu, set either your Server IP or the CNAME, pick your options, and hit save. The options are as follows: Remote Login All sites will log in through your main domain. This is good, because once youve logged in to one, you logged in to all (due to how cookies work). The downside is everyone will see their URL change when they log in. Permanent redirect (better for your bloggers pagerank) Instead of using your original URLs (like http://subsite.example.com ) you now use http://newdomain.com. Leave this checked, you want it. User domain mapping page If you want to allow users to map their own domains, check this. Redirect administration pages to blogs original domain (remote login disabled if redirect disabled) All sites Dashboards will remain referencing the main domain (i.e. http:// subsite.example.com/wp-admin instead of http:// newdomain.com/wp-admin ) Disable primary domain check. Sites will not redirect to one domain name. May cause duplicate content issues. - As it says. Then you go to the domains Menu and add in a new domain. Its as simple as filling in this form:
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 55 of 61
Thats it!
MULTIPLE NETWORKS
If youre running subdomains, sometimes you want to be able to create sub-sites off the subdomains, like http://subsite.example.com/newsite, or, in the case of mapped domains, have it run its own network. While it is possible, it always requires a plugin, and it can get complicated very quickly. WP Multi Network http://wordpress.org/extend/plugins/wp-multi-network/ Networks+ ($25.95) http://wpebooks.com/networks/
If your site gets very large, you may need to split it into multiple databases. HyperDB and SharDB are the best plugins for the job, but both require a great deal of SQL savvy. http://wordpress.org/extend/plugins/hyperdb/ http://wordpress.org/extend/plugins/shardb/
Its not easy, but yes. Keep in mind, you do not have to do this, and this process assumes youre familiar with WordPress, multisite, the database, and moving files. If thats not you,just leave them be.
http://halfelf.org/ebooks/wordpress-multisite-101/! Page 56 of 61
1. Copy all of your images from /blogs.dir/#/files/ to / uploads/sites/#/ 2. Search/replace your database, to change /blogs.dir/#/files/ to /uploads/sites/#/ - Youll want to change post_content, but you may also need to edit themes and widgets, so youll want to use the Search and Replace Script at http://interconnectit.com/124/searchand-replace-for-wordpress-databases/ for best results. 3. Edit every site in the Network Admin -> Site -> Options and blank out the options for upload_path , upload_url_path , and fileupload_url 4. Change the site option for ms_files_rewriting to false (this should be in wp_options) Kailey Lampert wrote a script to help with the Database edits, but its not something you should run on your production server without having a LOT of good backups. https://github.com/trepmal/ms-files.php-removal-utility
If you installed Multisite as a subfolder setup, you may recall that the /blog/ slug shows up in your posts, and you were told you cant change that? Actually, you can remove this if you absolutely must, but its not supported nor recommended. Go to Network Dashboard -> Sites and edit your main site. Click on the Settings tab and scroll down till you see Permalink Structure. Delete /blog from that so you just have /%year%/ %postname%/ or whatever you want your format to be.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 57 of 61
Please keep in mind, you now can never edit your permalinks on your main site, except through this method. If you go to your main sites dashboard and use the Permalink page there, the slug will magically return.
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 58 of 61
Chapter 13
Plugin Suggestions
Many tweaks to your site will require you to install plugins. The following plugins are some of the more popular additions to Multisite.
Network Menus
Sharing a menu across multiple sites can be frustrating, since each site can edit its own menus. Using the Networkwide Menu will help with that. http://wpmututorials.com/plugins/networkwide-menu/
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 59 of 61
WPMU New Blog Defaults extends the New Site Settings, allowing you to edit everything from Blog Title and Date Format to XML-RPC and Comment Moderation. http://wordpress.org/extend/plugins/wpmu-new-blog-defaults/
Copying Sites
Blog Copier and Replicator let you duplicate an entire site, whole sale, into a new on. http://wordpress.org/extend/plugins/blog-copier/ http://wpebooks.com/replicator/
Privacy
More Privacy Options and Network Privacy both extend the normal hide my site from search engines and allow you to hide certain sites from non-members. http://wordpress.org/extend/plugins/more-privacy-options/ http://wordpress.org/extend/plugins/network-privacy/
Spam Control
Nearly all spam plugins for WordPress will work on Multisite, however many need to be configured per-site. Sitewide Comment Control is a Multisite Only plugin that allows you to manage the ability of unregistered visitors to comment on all sites on your network. http://wordpress.org/extend/plugins/sitewide-comment-control/
http://halfelf.org/ebooks/wordpress-multisite-101/!
Page 60 of 61