 Oh, everybody, welcome back to the auditorium. The best room at WordCamp Phoenix, for sure. Up next, we are talking a little bit about WordPress Multisite. And to do that is the CTO of WPMU Dev, and also the CEO of? No. No? Just part of it? Well, CTO of all of those. All right. Well, anyway, talking about WordPress Multisite, Aaron Edwards. How are you guys doing? All right. WordPress Multisite. How many of you have heard of that? Yes, maybe? Good. Well, let's get started. First, who am I? As you said, I'm a CTO of Inksub, which is a funny name company. And it's the parent of WPMU Dev, which is more familiar, and edgy blogs and campus press. And make a lot of plug-ins, services. I love building things for WordPress, and I've been doing that for 10, 11 years now. So what is WordPress Multisite? Multisite is a network, a multisite network, is a collection of virtual sites that all share the same WordPress installation. So there's actually this really interesting feature hidden away in WordPress that a lot of people don't know about. And if you enable it, suddenly WordPress can be not just one site, but that same installed WordPress core files. It can power multiple to hundreds to thousands to even millions of WordPress sites all using the same set of core files on the same server. So it's a really powerful thing. A lot of people don't know about it. And I'll just give you a really brief history of that. It used to be called, way back in the day, WordPress MU, which is for multi-user. And it was actually a fork of WordPress that was maintained alongside. And it had all those multisite features in it. And then in WordPress 3.0 is when they decided to merge the two together and to include multisite inside of WordPress core itself. And that's when they renamed it to multisite. That's actually where my company, WPMU Dev, got its name. It's because it used to be called WordPress MU, multi-user, WPMU. And we were first started by providing plugins and services for multisite. So that's where it is, a brief overall picture. And it's kind of a redheaded step child to WordPress because not many people know about it. It doesn't really get that much attention. Even since WordPress 3.0, there's pretty much been no new features added to it. It still functions the exact same way. But there is a core set of people that use it and it is really useful for some key things. So first of all, when you create a multisite, there's a few examples of how it's usually used. So I'll give you the first one, which is open registration type networks. And a lot of you are probably familiar with WordPress.com, which is actually one WordPress installs, this huge WordPress install. And it has tens of millions of WordPress websites that are all running on the same set of core files. And they actually, you can sign up for free and create your own blog on there. And it's running on their same WordPress install. And then of course, they can sell paid upgrades to you. Hey, if I want more storage space, I want a custom domain, all these different things. They sell that to you on top of that normal package. So WordPress.com is a good example. edublogs.org, which is a large WordPress multisite install that my company maintains and manages for educators, teachers, students. And we have about four million WordPress sites hosted on that, four million blogs. And that's all on the same set of core files, all hosted together in one thing. And then my own personal little multisite install that I do kind of on the side of my free time. And it's actually what introduced me to WordPress in the first place, which is missionsplace.com. And it's an open network where missionaries can sign up to have a free website. The other type of network is much more common and much more used, and that's closed registration networks. So wordcamp.org is a really good example of that. How many of you went to the WordCamp website today to look at the schedule? Probably a lot of you. That's actually a WordPress multisite install. And what they do is this one hosted WordPress install. And every time there's a new WordCamp each year, they create a new sub-site. And that sub-site has its own theme and its own everything that the organizers of that WordCamp can control. But it's all hosted in one multisite install. One of them that we host through our CampusPress enterprise hosting is osu.edu. And that's Ohio State University. And they have a really large WordPress multisite install and they use that so that they can easily provide quick sites for the faculty, for different departments of the school, even for different campuses. Because the problem they had before was someone would always be saying, oh, I need a website. Some teachers, some class, whatever it was, I need a website. And instead of having to manage thousands of websites, they just have one WordPress multisite install that we host and then they can easily create sub-sites for each of those different departments that can have their own theme and control everything themselves. BBC America, that's a big website. They actually have a sub-site for every TV show that they host. So each one can have a slightly different theme and different things like that. Another common use case is company internets. So if they have like an internal site for their employees and everything, that's the same thing they could do. They don't even have to host it on the public internet. So that's the most common use case for multisite is these kind of private closed registration type ones. Now, when you're first enabling WordPress multisite, the first thing it's gonna ask you is do you want it to be sub-domain or subdirectory? And a lot of people don't really understand what the difference is. And just if you look right here, sub-domain, your main site will be like your domain, mysite.com, and then when a sub-site is created, it will be a sub-domain of that, like site1.mysite.com, site2.mysite.com, et cetera. And if you choose subdirectory, it's kind of the opposite. The site name comes afterwards in the directory name. And a lot of people love the sub-domain because it looks really clean and stuff, but in most cases I actually recommend against using that because there's a lot of things that you have to deal with when you do a sub-domain. First of all, it's a lot harder to set up because you have to do tricky things like wildcard DNS and you have to get a wildcard SSL certificate that can work for all those sub-domains, which is extra costs, and a lot of hosting providers don't provide wildcard sub-domains for free, and a lot of hosting providers that work with multisite, they don't even work with sub-domain by site. That's something to consider. Also in the future, if you wanna add like a CDN or a web application firewall in the cloud, those kind of things, a lot of them don't support a wildcard sub-domain, and so that can cause you a lot of trouble down the road. So in most cases, I recommend doing subdirectory if you can, unless you really want to deal with the trouble with that. Oh, and another thing I almost forgot about is security. So when it's a sub-domain bots and all the bad actors out there on the internet, it looks like a different WordPress installed to them. So they may have, say you have a login bot that's trying all these user names or whatever on your website to try to hack into it. They think that all those sub-domains are a different site, so they might be attacking all those different ones at different times or all at the same time, and so essentially when it comes to bots, even Google bots, search engine bots, things like that, they see them as distinct websites when it's sub-domain, and so you have to deal with a whole lot more load, a whole lot more traffic, and a whole lot more security implications. All right, now when you first create a site, you create what's called a network, and this is the default structure. You have your main site, which is kind of the parent at the top, and then you have all these subsites that are underneath it, and the whole thing together is called a network. That network has its own settings that reference that entire network of subsites that are underneath it. There's actually a hidden feature in multi-site itself that you can enable with plugins called multi-network that allows you to have multiple main domains with their own subsites underneath it, all in that same WordPress install. That's a little bit more advanced and less common to use, but just showing you how the structure works. So I wanna give you a very quick demo of what multi-site looks like after you enable it. So once you enable it, it actually creates a whole new section called the network admin, and see that all right? Okay, so this right here is what you would normally see, well, you would normally see the dashboard when you log into your WordPress site, right? The back end, you have all your normal things, post pages, that kinds of things, but when you have a multi-site enabled, you have this new menu up here, it says My Sites, and you can see all the different sites that my user has permissions for, and you can go to the dashboard of each of those things, or you can go up to network admin, which is a whole other section that has network after the URL, after the WP admin, and this is where you can manage your entire network. So you can see you have like a little widget here to manage your sites, users, if I go to the sites list, then I can see all the different sites that I've created under this multi-site network, what their URL is, you can do things like deactivating them, marking them as spam, you can even go in and edit them and control like some of the settings, like what users are assigned to it, and because each of these is a different WordPress site, you may have a user that's the same login for all these sites, but that user could be an admin on one of them, they could be a subscriber level on one of them, they can have different permissions for all different sites depending on what they're assigned to. So you can manage all that in the network admin, even what themes they have access to enable and other different settings like that, you can all control that in sites, and of course, you can create a new site here on the backend if you wanted. The users works very similar to the normal users panel in WordPress, except that you can see here what sites they have permissions for, see my user, I have three sites that I can access, and also we have a new user type, a new user level called super admin. Now super admin is a level above the normal WordPress admin, and that's the super administrator, and they're able to manage all the sites, they have full permissions to everything, it's like root access, and that's something that you can enable just in a user's profile like normal. And when it comes to themes and plugins in multi-site, they work a little bit differently too. So on the backend here, instead of activating a theme, I'm actually enabling it, which means I'm giving other sites permission to use that theme. So you can see network enable or network disable. So right now, the only enabled ones I have is 2019 and 2017. So if I go in here and look at one of my subsites, and go to the dashboard, open that up in another tab, I go down to themes and say I'm that user on that subsite and say, oh, even though there's 20 themes installed, I only can see an access to them. So that's kind of how permissions work a little bit differently in multi-site with themes. With plugins, it's a little bit different, this is a weird thing that I don't know why it's still in core. Some of us need to update it to get it working normally, but with plugins, on the network side, you can control only network activating, which means activating it across every site, and then the subsites, they don't have any control of that, or it being network deactivated across every site. So that's all that you can control from here, but there are plugins that I will talk about that allow you to change that behavior and give you more control of what plugins each site is allowed to enable. All right, now I'll drop back over to my slides. Some of the reasons why you might wanna use multi-site, some of the use cases that we're talking about, if you want each subsite to be able to have its own theme, maybe a different domain, its own permissions, even maybe the SEO power of having all these different sites all under one domain, the multi-site might be good for you. If you want to share your user accounts across multiple sites, for example, on wordcamp.org, like when you go to register, it says, enter your wordpress.org username, and that username that you log in is the same no matter what wordcamp site you're at, because they all share the same user database. So that can be a good feature of multi-site. If you want users to be able to create blogs or sites on demand, like you have an open registration thing like wordpress.com, it's a great fit for that. Internet sites, as we talked about, development and test sites, some people use it, they just have a multi-site, and they have a staging version of their site and a development version or whatever, and those are just sub-sites, and then that allows them to easily test on the same wordpress install, and then there's plugins that allow them to merge those changes back to the main blog. And probably the most common use case is if you have multiple personal or client sites. Say you're tired of having to deal with updates across all these different sites and all these different hosts. Maybe it may be more useful for you to merge all your clients into one wordpress install, then they can each have their own sub-site with their own permissions, and you can use an awesome plugin called the Domain Mac in Plugin that allows them to have a custom domain. And multi-lingual is another use case I've seen. People will have their main site as the main blog, maybe in English, and then they'll create sub-sites that are basically just a copy of that main one in a different language. And the best benefit is you have one wordpress install and codebase to maintain for updates and things like that. Now, multi-site might be too much for you if users shouldn't be all shared. For example, say you have WooCommerce or membership plugin on a sub-site where people have to register, like the public has to register. That might be really confusing to them if they try to register on the site when they had previously registered on some other site which they don't know are related at all. It's a completely different company or client or whatever, and that could be really confusing. It says, oh, your email's already taken because the user is shared between multiple sites on that same network. So sometimes that could be a little bit trouble there. Sometimes I've seen people, they just go overkill and say, oh, multi-site, I need multi-site. When really what they need to do is just use the core wordpress features of categories, tags, post types because they just are just trying to categorize content differently. Because in multi-site, every site has its own unique content and database, and there isn't really any clean way to be able to merge all the posts from multiple sites and display them in one place. You have to just think of each site is completely separated other than sharing user passwords is completely separated in every other way. So you have to consider that when you're making that decision. Also, like you're doing it for clients or something like that, if you need to give someone access to the file system, like to upload their own plugins or themes or different things like that or edit files, that it doesn't really work in multi-site because whatever they do, those files are shared between all the sub-sites. So if they upload a plugin or change some code somewhere that could take down or cause a hack or problem on all the other sub-sites. So it's really only good if you're gonna be with the one that's in charge of managing the code. When you're installing a multi-site, hosting is something that's a little bit different than just traditional wordpress. We're still not all hosts support it. I really don't recommend using shared hosting because with multi-site, even though you're using the same set of core files, every site has its own database tables, it has its own uploads. So you have to think about it resource-wise that it's using the same amount of resources as if you had multiple sites installed on that server. It's not just one site, it's amount of resources. So the amount of traffic they get, all those different things like that, it's gonna be multiplied by the number of sites. That's why some hosting providers, if they support multi-site, usually it's on a higher paid plan or even some hosts you have to pay for however many subsites you have, almost like you're just creating separate wordpress installs. And there's a good reason for that. Small networks, you can get started with a lot of the managed hosting providers like WPMU DevUs or WP Engine, or if you're a technical type and you wanna run your own virtual private server, that might be a good fit for just your entry-level multi-site. If you have a really large network, like in the thousands of sites, then you really want to get a real enterprise-level hosting provider that can handle that kind of load, that kind of technicality stuff. Or high-resist admin, if you get that big. Security is something that you also have to consider in multi-site. So if you have public registration enabled where they can create their own subsites, that means those are untrusted users and you have to be careful at what permissions you allow them. So there's things that you can set for what file types they're allowed to upload. You don't want them to upload any code or edit code, things like that. Embedding scripts, so this is an interesting thing. The admin user in multi-site is actually not as powerful as in single-site because the admin user in normal WordPress, they can upload any code. They can embed JavaScript code into a post or page, that kind of stuff. Which is fine because they're an admin, right? But in multi-site, admins suddenly aren't really trusted anymore because if they upload some JavaScript there, that could cause a hack that could affect all the other subsites on the network. So they actually take away the unfiltered HTML permission for that in multi-site. But the problem is, a lot of plugins and themes, they don't really understand that. So they might work fine in multi-site, but they're actually not really built to check that capability properly. They just assume, oh, it's an admin user. It's okay if they enter some code into this text field in the back of the theme options. Even though that's not really secure anymore because that user is untrusted now. So that's something to consider and to think about when you have an open registration. Also, just some things that you have to deal with, like content, like if you have untrusted users, I think on WordPress.com, how many people tried to create spam blogs or things like that to post spam or bad things or copyright suddenly are getting these DMCA takedown notices, people saying, oh, someone posted some copyrighted thing here. You gotta take it down. It's a lot of work and a lot of stuff to deal with when you're hosting a multi-site like that. It's open. Backups is another consideration. So with multi-site, as I said, the tables are duplicated for every site plus files, uploads for every site. So using like a plugin, like most of the backup plugins actually they don't even work with multi-site. Or if they do, you have to pay like a license for every sub-site. Because every site is considered separate really in practical terms. And so even if they do work, they can be unreliable, especially as you start getting into the tens or hundreds of blogs and that starts creating large databases that can take your site down if you try to back them up in a traditional way. So I recommend using your hosting backup solution, things that run on the server side, not plugins for those kind of backups from multi-site. Now upgrades and updates. It is great that you can update all the sites at once. So if you update a theme on your multi-site, it's actually updating it for every single sub-site that's using that theme because the code is shared between them all. So that's a good part. But also you have to figure out if you're gonna update that, that could affect every single site on the network, you know, not just the one. So that makes things a little bit tricky, things that you have to worry about. And if you have a really large network, there's a lot of scaling concerns because everything has to be updated separately. So here's a few like defines that we often use like in the WP config file that you can add. And that turns off some of the auto updates and things like that. So it won't take your site down necessarily when you're updating in the traditional way. Also, when you're getting to something that scale of a multi-site, using version control like git to manage your site, that's a really good idea. It's top doing like installing things and doing things from the dashboard, but actually doing things in a more tracked and reversible way using version control. And I'll just go through a few recommended plugins that a lot of people need or use on WordPress multi-site. So here's, you can look on the WordPress.org repo, they have a nice tag multi-site and that's a lot of plugins that are built for or support multi-site specifically. And there's a blog post, I'll have the link to the slides up after this so that you don't have to copy this whole town right now. One of the most common and most used plugins is the domain mapping plugin. As I talked about, if you need a separate custom domain, vanity domain for some of the subsites on your network, then the domain mapping plugin is the tool that you use for that. And there's a free version on WordPress.org which works pretty good. And there's a premium version that our company actually produces that has more bells and whistles and features like that. And that's really widely used, almost anyone that has a multi-site uses domain mapping plugin. New blog templates, it allows you to set like certain settings, plugins, themes, different things like that and have it so if someone creates a new site or you create a new site for a client, it could have that template already set up for them. That's a really useful tool. There's a free version and there's a premium version that we have. Anti-splog, if you allow open registration where the public can sign up and create their own site, suddenly, you know how bad comment spam is now? You know, we all hate comment spam. Accusement is a lifesaver there but there wasn't really an alternative for blog spam which we call splogs instead of spam. So spam blog, splog. And so I actually created a plugin called Anti-splog and it works kind of like Accusement but it's geared towards blog registration. So if people sign up for a blog it'll actually like scan the posts that they create and if it looks like spam it can mark those blogs spam, different things like that. So that can be a really useful plugin. Multisite Plugin Manager, that's another plugin that I made and that was the one I was referring to before where plugins in the network admin it doesn't behave the same way as themes and so this plugin here, Multisite Plugin Manager it allows you to choose which subsites can access certain plugins. It can choose, oh, this plugin should be auto activated on all these subsites when they're created. Different things like that. You can all manage that through using this third-party plugin that's on the repo. And now we have a little bit of time for questions because you probably have some questions and I'd love to answer them. He's coming with the microphone to you. Anywhere? Right up here in the front. Thanks. I might try and get a couple questions because the first one's fast. If you're doing top-level domains for all your subsites, does it matter whether you're using subdomains or subdirectories? It wouldn't really, no. Okay. But it would be easier to use subdirectories first. Sure. All right, that's good to know. And then that was a fast one. So is it possible to do Multisite across servers, mainly to deal with database sizes and that sort of thing? Yes, like for example, edgibogs.org that we host, edgibogs.org. That runs across, I think, we have like seven application servers. Then we have 10 database servers that it's divided across. Plus we have varnish caching servers and then CDN and then S3 uploads. I'm guessing that's all custom. Not all of it actually. There's a few tools. There's one called for dividing a database is the technical term is called sharding. And so what it does is it says, okay, this blog, we're gonna put this table on another database server somewhere else. So it allows you to scale to an unlimited amount of sites. So there's a plugin that's really awesome out there. Well, one that we coded called Multidb. That's free on github.org. We don't really support it very well anymore. The only place we use it really is edgibogs that we made custom. But there's a great one out there called ludicrousdb. If you wanna look at that and that allows you to divide your database into unlimited amount of servers. To scale unlimited, basically. Anyone else with the question? Right here in the front. We had that slide up. And I think you had the sub, earlier we had that slide up showed I think sub-domains on the left and sub-directories on the right. Yes. Said you preferred sub-directories for several reasons you explained. Yes. If a system has been set up with sub-domains, is it possible to convert it to sub-directories? It's possible, but it's not easy. How many blogs do you have? Six sites. Six, that wouldn't be too bad. Would be doable. If you Google, there's tutorials that people have made. You basically just have to change various things in the database. Using the tool WPCLI, which I think there's actually a session about that after this one, that could be really useful in helping you make some of those adjustments because you have to find and replace a lot of the URLs in the database that were already set up. Yeah, I've thought about doing the same on my multi-site, which is about 1,000 sites, but I haven't gotten around to it. Anyone else in the back? What about campaign micro-sites? Would multi-site be a good usage for a product micro-site or, I mean, I know the WordCamp event website is perfect, but a company that might do different micro-sites for different purposes, would multi-site be a good use for that? Yeah, that's a great use for that. Micro-sites, like I've seen companies where they have, they use a multi-site network and it's basically the same company, but they just kind of rebrand it for every city. So they have a Dallas version and a Washington DC version or whatever, and they use the same theme activated across the both, but it can change the design and different things like that, and that way they can just use the main one as a template and copy it over to the sub-site, and it makes it really easy to manage all that in one place with the same users that have access to all of them. Yeah, so that's a great use case, for sure. Anyone else in the front here making them run? So you mentioned one of the most commonly used is like people who do client sites or manage multiple sites, right? Yes. How easy or difficult is it if there's a separation of service to pull that client site and give it to them? Well, I wouldn't say it's super easy. Yeah, it's definitely, I mean, you can do obviously the traditional export, import, and WordPress, that's not very reliable for larger things, but it definitely is possible. Some of the backup plugins support that, some of the migration plugins support that, like moving a regular site into a multi-site or out into a single site, and of course you can do it manually. I'm sure there's tutorials online that I've seen before that kind of walk you through how to do that. But the tables themselves are not really very different at all. So like moving it out, it's not that hard of a process. Anyone else? All right, well thank you so much for listening. I hope you learned something about multi-site. Maybe a cool tool that you can use for your businesses. And there's a link to the slides there. And I'll leave that up for you guys if you want to download that later. And if you have any more questions, you can find me at our WPMU Dev booth right here. I'll be there most of the day and tomorrow too. Thank you. Awesome, you took care of all of my closing statements. Let's hear it one more time for Aaron. Are you gonna be hanging out at the Happiness Bar at all? Or just mostly at the WPMU Dev table? Perfect.