WP-CLI Core Commands

Answers common questions about installing and deploying WordPress with WP-CLI core commands, including wp core download, wp config create, wp db create, and wp core install. Learn the correct order to run them, when to pin a version, and why WP-CLI beats the web installer.

8

questions

Can I install WordPress in a subdirectory with WP-CLI?

Yes. Pass the full URL including the path to wp core install –url=. Download and config steps stay the same; only the site URL changes.

Can I run wp core install without wp config create?

No. WordPress needs database credentials in wp-config.php before installation. Without config, WP-CLI cannot connect to MySQL and the install will fail.

Do I always need wp db create?

Only when the database named in wp-config.php does not exist yet. On shared hosting the database is often pre-created — then skip this step. On local dev, create it with WP-CLI.

Should I pin a WordPress version when downloading?

For most installs, use the latest stable release without –version. Pin a version only when you intentionally need parity with production or a legacy environment.

What directory should I run wp core download in?

Use an empty directory for a fresh site. WP-CLI downloads core files into the current working directory. Mixing with existing files can leave stale plugins or themes from an old project.

What happens if I skip wp db create on a new local site?

wp core install fails because MySQL cannot connect to a database that does not exist. The error looks like a credentials problem but the fix is creating the database first.

What is the correct order to deploy WordPress with WP-CLI?

Download core (wp core download), create configuration (wp config create), create the database (wp db create), then install (wp core install). Each step depends on the previous one.

Why use WP-CLI instead of the web installer?

WP-CLI is scriptable and repeatable — the same commands work on local, staging, and CI pipelines. No browser clicks, no upload limits, and easy to document as code.