wp core install
Overview
Complete the WordPress installation non-interactively. Replaces the browser-based five-minute install wizard and makes site provisioning fully scriptable.
What It Does
wp core install runs the WordPress database installation, creates all required tables, and creates the first admin user. It requires a working wp-config.php and an accessible database.
Syntax
wp core install --url=<url> --title=<title> --admin_user=<user> --admin_password=<pass> --admin_email=<email> [OPTIONS]
Required Options
| Flag | Description |
|---|---|
--url=URL | Full site URL (e.g. https://example.com) |
--title=TITLE | Site title |
--admin_user=USER | Admin username |
--admin_password=PASS | Admin password |
--admin_email=EMAIL | Admin email address |
Optional Flags
| Flag | Description |
|---|---|
--skip-email | Do not send the admin notification email |
--locale=LOCALE | Set site language |
Basic Usage
Standard installation
wp core install \
--url="https://example.com" \
--title="My WordPress Site" \
--admin_user="admin" \
--admin_password="Admin1234!" \
--admin_email="admin@example.com"
Skip notification email
wp core install \
--url="https://example.com" \
--title="My Site" \
--admin_user="admin" \
--admin_password="Admin1234!" \
--admin_email="admin@example.com" \
--skip-email
Local development install
wp core install \
--url="http://localhost" \
--title="Dev Site" \
--admin_user="admin" \
--admin_password="admin" \
--admin_email="dev@localhost" \
--skip-email
Expected Output
Success: WordPress installed successfully.
If already installed:
Error: WordPress is already installed.
Prerequisites
Before running wp core install, ensure:
- ✅ WordPress files are downloaded (
wp core download) - ✅
wp-config.phpexists (wp config create) - ✅ Database exists and is accessible (
wp db create)
# Full setup sequence
wp core download
wp config create --dbname=mydb --dbuser=root --dbpass=secret
wp db create
wp core install \
--url="https://example.com" \
--title="My Site" \
--admin_user="admin" \
--admin_password="Admin1234!" \
--admin_email="admin@example.com" \
--skip-email
Real-World Scenarios
Scenario 1: Automated provisioning script (environment variables)
#!/bin/bash
wp core download --locale="${WP_LOCALE:-en_US}"
wp config create \
--dbname="${DB_NAME}" \
--dbuser="${DB_USER}" \
--dbpass="${DB_PASS}" \
--dbhost="${DB_HOST:-localhost}"
wp db create
wp core install \
--url="${SITE_URL}" \
--title="${SITE_TITLE}" \
--admin_user="${ADMIN_USER}" \
--admin_password="${ADMIN_PASS}" \
--admin_email="${ADMIN_EMAIL}" \
--skip-email
echo "Site ready at ${SITE_URL}"
Scenario 2: Docker entrypoint installation
# check if already installed before running
if ! wp core is-installed 2>/dev/null; then
wp core install \
--url="http://localhost" \
--title="Docker Dev" \
--admin_user=admin \
--admin_password=admin \
--admin_email=admin@localhost \
--skip-email
fi
Scenario 3: Staging environment setup
wp core install \
--url="https://staging.example.com" \
--title="Staging - Example" \
--admin_user=stagingadmin \
--admin_password="$(openssl rand -base64 16)" \
--admin_email=devteam@example.com \
--skip-email
Best Practices
- Never use
adminas username in production — it is a brute-force target. - Use strong, randomly generated passwords —
openssl rand -base64 24. - Use
--skip-emailin automated scripts to avoid sending notification emails. - Use environment variables for credentials — never hardcode in scripts.
- Verify with
wp core is-installedbefore running to prevent re-installation errors.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: WordPress is already installed | Site already set up | Use wp core is-installed to check first |
Error: Database connection failed | Wrong credentials or DB not created | Run wp db create and check wp-config.php |
Error: Unknown error installing WordPress | Table conflict or corrupted DB | wp db reset then re-run |
| Admin email arrives unexpectedly | --skip-email not used | Add --skip-email in automation |
Quick Reference
wp core install --url=https://example.com --title="My Site" \
--admin_user=admin --admin_password=Admin1234! --admin_email=admin@example.com
wp core install ... --skip-email # Skip notification
wp core is-installed && echo "Already up" # Check before installing
Next Steps
wp core is-installed— check if WordPress is already installed before running.wp core update— keep WordPress up to date after install.wp core update-db— update the database schema after upgrades.wp plugin install— install plugins after setup.