wp core multisite-install
Convert a single WordPress site into a multisite network from the command line. Sets up the network database tables and rewrites wp-config.php and .htaccess as needed.
What It Does
wp core multisite-install runs the multisite network installation against an existing WordPress install. It creates the wp_blogs, wp_site, wp_sitemeta, and other network tables, and sets up the first site of the network.
WordPress must already be installed (wp core install) before running this command. For a brand-new multisite network on an empty install, use wp core multisite-install directly after wp config create and wp db create.
Syntax
wp core multisite-install [--title=<network-title>] [--base=<url-path>] [--subdomains] [--skip-config] [--skip-email]
Options & Flags
| Flag | Default | Description |
|---|---|---|
--title=TITLE | Site title | Title for the network |
--base=PATH | / | Path base for the network (e.g. /network/) |
--subdomains | — | Use subdomain URLs (site1.example.com) instead of subdirectory (example.com/site1/) |
--skip-config | — | Do not update wp-config.php automatically |
--skip-email | — | Do not send notification email |
Basic Usage
Subdirectory network (default)
wp core multisite-install \
--title="My Network" \
--skip-email
Subdomain network
wp core multisite-install \
--title="My Network" \
--subdomains \
--skip-email
Expected Output
Set up multisite database tables.
Added multisite constants to 'wp-config.php'.
Success: Network installed. Don't forget to set up rewrite rules (see https://developer.wordpress.org/apis/multisite/).
What Gets Modified
After running wp core multisite-install, WP-CLI:
-
Creates additional database tables:
wp_blogs,wp_blog_versions,wp_registration_log,wp_signups,wp_site,wp_sitemeta,wp_users(shared) -
Adds constants to
wp-config.php:define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false ); // or true for subdomain
define( 'DOMAIN_CURRENT_SITE', 'example.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 ); -
Updates
.htaccess(Apache) or prompts for Nginx rewrite rules.
Real-World Scenarios
Scenario 1: Brand new multisite from scratch
cd /var/www/html
wp core download
wp config create --dbname=networkdb --dbuser=wpuser --dbpass=secret
wp db create
wp core install \
--url="https://example.com" \
--title="Main Site" \
--admin_user=netadmin \
--admin_password=Admin1234! \
--admin_email=admin@example.com \
--skip-email
wp core multisite-install --title="My Network" --skip-email
Scenario 2: Agency multisite with subdomains
wp core multisite-install \
--title="Agency Network" \
--subdomains \
--skip-email
# Create client sites
wp site create --slug=client1 --title="Client One" --email=client1@example.com
wp site create --slug=client2 --title="Client Two" --email=client2@example.com
Scenario 3: Subdirectory multisite with custom base
wp core multisite-install \
--title="Multi Blog Network" \
--base=/sites/ \
--skip-email
After Installation
Required .htaccess rules (Apache — subdirectory)
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
For Nginx, see WordPress Multisite with Nginx.
Best Practices
- Back up before conversion if converting an existing single site.
- Use
--subdomainsfor enterprise/agency networks — cleaner URLs and easier SSL with wildcard certs. - Use subdirectory for lightweight blogs — simpler DNS setup.
- Configure wildcard DNS (
*.example.com) before enabling subdomain multisite. - Verify server rewrite rules — the network will not work correctly without them.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Child sites return 404 | Rewrite rules not updated | Update .htaccess or Nginx config |
| Admin can't access network dashboard | MULTISITE not set | Check wp-config.php for multisite constants |
| Sites not accessible on subdomains | No wildcard DNS | Configure *.example.com DNS record |
| Conversion fails on existing site | DB tables conflict | Check for stale network tables; run wp db check |
Quick Reference
wp core multisite-install --title="Network" --skip-email # Subdirectory
wp core multisite-install --title="Network" --subdomains --skip-email # Subdomain
wp site create --slug=newblog --title="New Blog" # Add a site
wp site list # List all sites
Next Steps
wp site create— add sites to the network.wp site list— list all network sites.wp super-admin add— grant network admin access.