Multi-site WordPress can get a bit confusing for those uninitiated. So let’s go through a bit about them, and how you can go about getting started with a WordPress multi-site installation. There is room for a lot of decisions and customization. How will we deploy? Where will we host it? What tools will be required to monitor and maintain such an instance? Most importantly, how will we create a local environment that will reflect our multi-site network on a remote server.
What is a Multi-Site?
A WordPress multisite is a collection of sites that share a single WordPress installation. They can share plugins and themes, but the individual sites are virtual. They don’t have their own directories on your server, aside from media uploads, but they have separate tables in the MySQL database.
Think of a multi-site as a network of WordPress sites. Where a network is the WordPress installation with core files, themes, plugins, etc, and each site is just a virtual site, with a different table in the database. Much like a single instance is a way to manage blog posts, categories, and content, a multi-site is a way to manage many WordPress instances on a single installation.
Setting up a Local WordPress Multi-Site
To simplify and add the ability to share this type of configuration with a client, other developers, or your boss perhaps, let’s use something to containerize the process.
Lando is a fantastic tool developed by my friend and his team at Tandem. It spins up local Docker environments based on .yml configurations. It handles all the services including setting up the LAMP stack, routing the containers, port management, instance installation, and database importation. It’s pretty amazing. Check it out here: https://docs.lando.dev/.
Step 1 – Download and Install Lando
This is simple if you are on a Mac. It’s going to install Docker for you as well. If you already use Docker, you can remove the current version, or brew will error out during the install.
brew cask install lando to get started. It takes a while to install since it has to download all the packages, so grab a cup of coffee while you wait.
Step 2 – Initialize a new Lando yml file
This command will initialize a yml file, which we need to modify slightly:
lando init \ --source remote \ --remote-url https://wordpress.org/latest.tar.gz \ --recipe wordpress \ --webroot wordpress \ --name wordpress-app