iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

Multisite

WordPress Multisite turns one install into a network of sites with shared core, shared themes, and shared plugins, each with its own database tables. Use it for chains, franchise networks, language variants, or a SaaS where every customer gets a sub-site. Reach for separate installs only when the sites differ structurally enough to share nothing.

Convert a single site to Multisite + admin patterns

EXAMPLE
# 1) Enable Multisite in wp-config.php (above the require_once... line)
define('WP_ALLOW_MULTISITE', true);

# 2) Choose subdomains vs subdirectories DURING setup
#    - Subdirectories (example.com/site1):  works on any install
#    - Subdomains    (site1.example.com):   requires wildcard DNS + Apache/nginx rewrite

# 3) Add network constants AFTER 'Tools -> Network Setup' gives you the snippet
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);                 // true for subdomains
define('DOMAIN_CURRENT_SITE', 'example.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

# 4) .htaccess rules — replace the standard WP block with the Network Setup output

# 5) Useful WP-CLI commands once you are multisite
wp site list --fields=blog_id,url,name
wp site create --slug=stores-sydney --title='Sydney store'
wp site delete 4 --yes
wp super-admin add alice                   # grant network-level admin
wp option get siteurl --url=stores-sydney.example.com

# 6) Network-activate a plugin (works on every sub-site)
wp plugin activate yoast-seo --network

# Activate per-site for a specific subsite
wp plugin activate woocommerce --url=stores-melbourne.example.com

# 7) Theme strategy
#    - Use ONE theme, with theme.json palettes per site, when sites should feel unified
#    - Use child themes for per-site overrides without forking
#    - Network admins enable themes for the network; site admins choose from those

# 8) User strategy
#    - Roles are PER SITE (a user can be Editor of A, Author of B, none of C)
#    - 'Super Admin' is a NETWORK role with full power; grant sparingly

# 9) Data + isolation
#    - Each subsite gets wp_<ID>_posts, wp_<ID>_options, etc.
#    - wp_users and wp_usermeta are SHARED — same email = same person
#    - Backups: pg_dump / mysqldump the whole DB; per-site export with WP-CLI
wp db export shop-network-$(date +%F).sql

# 10) Performance considerations
#    - One persistent object cache (Redis / Memcached) is shared across sites
#    - Use a CDN that respects the Host header; subsite URLs must hit subsite caches
#    - Disable autoloading on rarely-read options on busy sites
#    - Don't enable 100 plugins network-wide; each loads on every site request

# 11) When NOT to use Multisite
#    - Sites need wildly different plugin sets and update cadences
#    - You need separate DB instances for data sovereignty
#    - You want per-site infrastructure isolation (memory limits, PHP versions)
#    -> Just run separate installs. Multisite reduces ops only when the sites
#      share enough to make the trade worth it.

Why it matters

Multisite is the right call when sites share design, plugins, and editorial workflow but need distinct content and URLs. The moment one site needs a fundamentally different plugin or theme strategy, that one site is the dog wagging the network — split it out before the conflict becomes the tail wagging every release.

Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.

Example

Example
# Run many sites on one install.
# Add: define('WP_ALLOW_MULTISITE', true); to wp-config.php
Try it Yourself »

Discussion

Loading…