Stackable Uses a WordPress Multitenancy Architecture

Two weekends ago I decided to start building Stackable as a WordPress plugin. This gives an interface to stacking multiple WordPress sites on a single WordPress instance as explained here. It’s currently under development and I’m pretty excited about getting this into the hands of other WordPress developers to try it out.

Recently I was asked how Stackable is different from WordPress multitenacy. I honestly wasn’t familiar with the term multitenancy and had to go down my own rabbit hole of research. My conclusion is that Stackable is simply my approach to WordPress Multitenancy. If you, like myself, have never heard of multitenacy then let’s take a closer look and also explain how I’m building Stackable.

Multitenancy is a common term that describes when a single instance of software serves multiple tenants.

Any software, not just WordPress, can be configured as multitenancy. This is not be confused with WordPress Multisite which is an official WordPress mode. Rather WordPress multitenancy allows you to run many WordPress sites, any mode you wish, from a single WordPress instance. Yes you heard me correctly, any mode. That means in theory you could serve many different WordPress multisite networks from a single WordPress instance using a multitenancy configuration. It’s pretty mind-bending what is possible.

If you do a search for WordPress Multitenancy you’ll find lots of different implementations, however there isn’t any official documentation, from either the codex or developer resources, on the topic. Here are a few references to the more documented approaches out there.

Stackable is a lightweight interface with some clever wp-config.php handling.

I stumbled into making Stackable while playing around with dynamic variables within wp-config.php. By dynamically assigning $table_prefix you can direct each web request to an entirely separate WordPress site without hacking around the file system or doing complicated symlinks. It’s a very direct way to enable many sites on a single WordPress installation.

Under the hood, configuring Stackable will automatically inject custom lines into wp-config.php as well as store a few database entries to the primary’s site’s options table. This a very clean approach and doesn’t require getting too technical in order to use.

Stackable’s automatic output to wp-config.php with shared files and domain mapping off.

I plan to release Stackable before the end of summer 2020. If you’re curious about the project then follow along at https://stackablewp.com and watch the early look video.