Getting Started with WordPress Multisite
Have you ever thought about trying out WordPress Multisite? Are you curious as to what all the chatter is about, or perhaps you’d just like to see what plugins are multisite compatible? Starting with DesktopServer 3.2.2 for premium members, you can develop your WordPress Multisite domain solution without having to sign up with a hosting provider, pay extra for multi-domain or subdomain hosting during development, configure a DNS for wildcards or specific third level domains (aka subdomains), then wait for propagation, then… well, you get the idea. Instead, I’ll show you how you can get started on development right away with just a few clicks.
In this article
Introducing WordPress Multisite
DesktopServer allows you to create a WordPress Multisite installation and add as many pseudo domains or subdomains as you want so you can get to developing right away. But first, what is WordPress Multisite?
In a nutshell, WordPress Multisite enables multiple WordPress websites to be powered off a single install. WordPress.com is an example of a very large multisite installation. Small or large, the real power is about the possibilities and the avenues that open up for developers to create larger websites, enterprise level solutions, or just for logically organizing a website’s content and dividing tasks.
Why choose WordPress Multisite?
- Update once as all updates to plugins, core, and themes are centralized
- User consolidation: Users can be members of one, many or all sites
- Divide admin authority: Admins for one, many, or all sites
- Simplify maintenance: Essentially you backup one site
What are some examples of “enterprise” solutions?
Create a company website and separate sub sites for support, or divisions:
Have personalized sites for education districts, or organizations that share a common parent:
As you can see, WordPress Multisite is a great solution for enterprise development (or the art of breaking down “business practice areas” into domains or subdomains). You can make each subdomain use the same theme to enforce standards and unity; such as a car dealership affiliate or franchise business owner. A child theme could allow for customizations to be applied to a single owner. In contrast, you could have a totally different theme for a subdomain; like WordPress’ beautiful P2 theme for realtime support or a live classroom discussion below a streaming video of a classes’ lecture. With WordPress Multisite, the possibilities are endless.
You can create and test WordPress Multisite with sub directories but this article tackles the more polished, professional looking subdomain option. To get started with WordPress Multisite, fireup DesktopServer and create a site with no third-level (subdomain), i.e. do not put a ‘www’ in front of the domain name. Also, check on the “Allow Multisite Network” checkbox. Click the thumbnail at the right for an example view.
The “Allow Multisite Network” will automatically add the WP_ALLOW_MULTISITE constant to our wp-config.php file. You can do this manually to convert an existing site to multisite by just dropping in the code, as seen here on line 83, just above the “That’s all” comment.
/** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. */ define( 'FS_METHOD', 'direct' ); define('WP_DEBUG', false); define('WP_ALLOW_MULTISITE', true); /* That's all, stop editing! Happy blogging. */
Once the site is created or you have manually inserted the allow multisite option, you will have access to the “Network Setup” menu option under the Tools menu in WordPress’ admin pages. Select it and you can then choose the default “Sub-domains” and then click the “Install” button. From there, you will be greeted with two more text boxes. We’re only concerned with the first one for our development site. The contents of which, need to be appended to our wp-config.php file located in the root of our website files. Open the wp-config.php file and add the contents of the first text area, per the instructions, just above the “That’s all” line. It should now read something like this (for a domain company.dev):us leo.
/** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. */ define( 'FS_METHOD', 'direct' ); define('WP_DEBUG', false); define('WP_ALLOW_MULTISITE', true); define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', true ); $base = '/'; define( 'DOMAIN_CURRENT_SITE', 'company.dev' ); define( 'PATH_CURRENT_SITE', '/' ); define( 'SITE_ID_CURRENT_SITE', 1 ); define( 'BLOG_ID_CURRENT_SITE', 1 ); /* That's all, stop editing! Happy blogging. */
In our initial tests, we didn’t need to update our .htaccess file. But if you have custom permalinks, this is a requirement. Care should be taken to create the .htaccess as a pure text file. To do this, use Notepad on Windows or Text Wrangler on Mac (recommended, free). Special care should be taken if you use Mac’s Text Edit. Since .htaccess is a hidden file on Mac (all files beginning with a period are), use Shift + Command + . (period) to toggle seeing hidden files when using Text Edit’s Open or Save windows. Also, Mac users should be sure to use Text Edit’s Format ? Make Plain Text pull down menu option to ensure you are saving a valid .htaccess file as plain text. Notepad users on Windows should use the “Save as type” option to avoid putting a .txt extension on the .htaccess filename.
After updating your wp-config.php file and optionally your .htaccess, your login session will be reset and you’ll have to log back into the administrator pages. Upon login, you should immediately notice that you are multisite ready. You can tell by the layout of the left hand sidebar menu in the administrator pages. The key to understanding WordPress Multisite is knowing which admin menu mode you are in. 1) Network Admin or 2) Site Admin. You can toggle between these two states via the drop down menu in the upper right hand corner where you find the “Howdy, …” admin user name (see figure below).
Network Admin is where you will find the centralized management of plugins, themes, and users as it applies to all your sites. In addition, there is the Sites menu group at the very top of the left hand administration menu. This is where you can create additional sites. The Site Admin option is for management of the individual site. Remember, you already have one main site at the second level domain (i.e. company.dev, w/out the ‘www’). Next we’re going to create our first subdomain (aka third-level domain).
You might see a warning message in admin pages with regards to “wildcard domains” not being setup, you can safely ignore this. On a real web server, you’d configure your DNS to take a wildcard, or any subdomain name automatically. This allows for faster creation of any third-level domain name (i.e. tom.example.com, jane.example.com, etc.). But for testing and security purposes, DesktopServer will only allow predefined subdomains; subdomains that we have already told the server are OK to exist. Go back to DesktopServer and create a subdomain by selecting the “Create or edit multisite aliases” option and click “Next” to continue.
DesktopServer will present you with a drop down combo box containing a list of WordPress websites that you have created prior. Select your newly created multisite enabled website (in our example to the left, company.dev). A list of mapped domain names will appear (empty for the first time) and you can add or remove new domain names using the obvious “Add” and “Remove” buttons below the list box. Click “Add” to create your first subdomain. A dialog box will appear with a textbox for you to enter a domain name. Not just a subdomain, but any domain name along our pseudo top-level domain .dev (dot D-E-V).
When you use WordPress Multisite, you are not limited to just subdomains. WordPress.com users will note that when they sign up for a free WordPress.com website, they get their own subdomain username.wordpress.com. For an extra fee at wordpress.com, users can map their own full domain name rather than use a third level domain that ends with wordpress.com. Your self-hosted WordPress installation can also do full domain name mapping with the official Automattic WordPress MU Domain Mapping plugin and you can test it out with DesktopServer just as well. But for now, we are going to stick with a subdomain. Be sure to type in your subdomain name followed by a period and the existing domain name of the actual WordPress Multisite website you created (the .dev will be appended for you). So if we wanted to create a “chicago” subdomain for our existing company.dev website, we would type in chicago.company in the given textbox (as seen in the illustration above). Click “OK”, followed by “Next”. In a few seconds DesktopServer will make the adjustments needed and restart your web server. At this point, if you attempt to visit your subdomain website without it actually being added in WordPress Multisite first, you will fall back to the main site (i.e. company.dev). You may also see a message indicating “Registration has been disabled” when using the default registration settings.
Add a Website
To add a website, we need to go back to the Network Admin screen in WordPress. From there, click the “Sites” menu at the top followed by “Add New”. If you see the “Posts” menu item vs “Sites”, then you are not in Network Admin, but rather Site Admin. Switch by clicking the drop down menu in the upper right hand corner of where it typically says “Howdy, admin” (see the second illustration). You should be presented with a series of text boxes to add a new site. Enter the subdomain name portion only, (i.e. chicago), followed by the site’s title and the admin email. WordPress Multisite allows you to assign a different administrator to manage the site. While your master “Super Admin” credentials will allow you to have full reign over your WordPress Multisite, the admin email you provide here will allow that given user the ability to control aspects of only the subdomain site (moderate, manage users, activate available themes -if any are available, etc.). After clicking “Add Site”, you should be able to visit your newly created subdomain featuring it’s own independent theme, content, and users.
In a typical installation, users that register with the subdomain are only members of that subdomain site. They would have to be manually added by the given site administrator to each subdomain site or re-register (ask to join) each subdomain they wish to become members of. However, you can also have a user automatically join every site that is apart of a multisite network with a nifty Multisite User Management plugin. The plugin allows a new user to automatically join all sites. For instance, if you were creating a parent website where a customer can feel at home, no matter which branch or subdomain they visit, this is the plugin for you.
Now that you’ve created your first WordPress Multisite and your subdomain, you are ready to build out your project, test out features, or examine the multitude of available plugins. Best of all, DesktopServer can create as many multisite websites and subdomains as you want. Keep them for reference, or for accelerating your next project. You can take your time without worrying about hosting contracts, domain name registration fees/expiration, and can deploy when you’re confident and ready. Additional information about WordPress Multisite is available in the official codex. If you have any immediate questions, feel free to hit us up in our forums. Enjoy!