wp core multisite-install
Overview
Install the multisite version of WordPress from scratch. This command handles the database installation, creates the first network, sets up the super admin, and provides the necessary wp-config.php and .htaccess constants.
What It Does
wp core multisite-install converts a standard (uninstalled) WordPress directory into a Multisite network. It installs the tables required for a network and configures the first site. Note: This is for fresh installs. To convert an existing single site to multisite, use wp core multisite-convert.
Syntax
wp core multisite-install [OPTIONS]
Options
| Flag | Description |
|---|---|
--url=URL | The URL of the new network |
--title=TITLE | The title of the new network |
--admin_user=USER | Username for the super admin |
--admin_password=PW | Password for the super admin |
--admin_email=EMAIL | Email for the super admin |
--subdomains | Use subdomains (e.g., site1.example.com) instead of subdirectories |
--skip-config | Don't output the configuration constants |
Basic Usage
Install as subdirectories (Default)
wp core multisite-install \
--url=example.com \
--title="My Network" \
--admin_user=admin \
--admin_password=password \
--admin_email=admin@example.com
Output:
Success: Network installed.
Install as subdomains
wp core multisite-install \
--url=example.com \
--title="My Global Network" \
--admin_user=superadmin \
--subdomains
After Installation
After running the command, WP-CLI will output the constants you need to add to your wp-config.php.
Example Output snippet:
define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
define( 'DOMAIN_CURRENT_SITE', 'example.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );
Real-World Scenarios
Scenario 1: Automated Dev Network Setup
#!/bin/bash
wp core download
wp config create --dbname=wp_multisite --dbuser=root --dbpass=root
wp db create
wp core multisite-install --url=dev.local --title="Dev Network" --admin_user=dev --subdomains
Scenario 2: Installing without echoing sensitive config
wp core multisite-install --url=example.com --title="Silent Install" --admin_user=admin --skip-config
Best Practices
- Decide strategy early — Switching between subdomains and subdirectories later is difficult.
- Use strong passwords — The first user created is a Super Admin with full network access.
- Backup before conversion — If you are trying to "re-install" over a messy state, clean the DB first.
Next Steps
wp site create— add your first subsite.wp super-admin add— grant others network control.