Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Setup & site building · Guide

How to Install WordPress With WP-CLI

How to Install WordPress With WP-CLI

Short answer

To install WordPress with WP-CLI, run wp core download, wp config create with your database details, wp db create, then wp core install with the site URL, title, admin username, and admin email. The install command creates the WordPress tables in seconds and prints a success message. You need SSH access to the server and WP-CLI installed first.

Key takeaways

  • WP-CLI is the command line interface for WordPress and needs PHP 7.2.24 or later.
  • Four commands install WordPress: wp core download, wp config create, wp db create, and wp core install.
  • wp core install creates the WordPress tables in seconds or less.
  • The admin password is generated at random if you leave it out of the command.
  • A subfolder install needs wp option update siteurl run after wp core install.

What is WP-CLI?

WP-CLI is the command line interface for WordPress, a tool that runs admin and development tasks from the terminal instead of the dashboard.

The WP-CLI handbook on make.wordpress.org describes it as the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The guide to what WP-CLI is covers the basics if you have never used it.

WP-CLI needs PHP 7.2.24 or later, according to the same handbook. It has no extra needs beyond those of WordPress itself.

You type commands such as wp core download and wp core install, and the tool prints a short success line for each one. That makes it a good fit for repeat installs and for servers you manage by SSH.

What do you need before you install WordPress with WP-CLI?

You need SSH access to your server, WP-CLI installed, a domain name, and database details from your host.

Shared hosts often block SSH, so check with your host first. If you have no shell access, use the one-click installer or the manual install instead.

You also need a database ready, or the rights to create one. The wp db create command can make it for you if your MySQL user has the rights.

Have these details to hand: the database name, the database username, the password, the database host (usually localhost), the site URL, the site title, the admin username, and the admin email. You will pass them to the commands below.

How do you install WP-CLI?

Download the wp-cli.phar file, mark it executable, and move it to a folder on your PATH so you can type wp.

The WP-CLI handbook on make.wordpress.org recommends downloading the Phar build, marking it executable, and placing it on your PATH. The commands are:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

The handbook also suggests checking the download before you use it, with GPG signatures or checksums, so you know the file has not been tampered with.

Run wp --info to check the install. If WP-CLI is installed, the output shows the operating system, the PHP version, and the WP-CLI version. You can update it at any time with wp cli update.

How do you download WordPress with WP-CLI?

Run wp core download in the folder where the site should live, and it fetches and extracts the latest WordPress files.

The wp core download docs state that the command downloads and extracts WordPress core files to the given path, or the current folder when no path is given. The downloaded build is checked against its md5 hash, then cached on the local file system.

Run this in the empty folder for your site:

wp core download

Useful options include --locale to pick a language, --version to pick a release such as latest or nightly, and --skip-content to leave out the default themes and plugins. For example, wp core download --locale=nl_NL fetches the Dutch build, as the docs show.

The download step puts the files in place. It does not create the database or the config file, which is the next step.

How do you create the config file and database?

Run wp config create first, then wp db create, since the database command reads its details from wp-config.php.

The wp config create docs state that the command creates a new wp-config.php with database constants, and checks that the database constants are correct. A standard run looks like this:

wp config create --dbname=example_db --dbuser=example_user --dbpass=example_pass
wp db create

The wp db create docs state that the command runs a CREATE DATABASE statement using the DB_HOST, DB_NAME, DB_USER, and DB_PASSWORD values from wp-config.php. That is why the config file must exist first.

The defaults are worth knowing: the database host defaults to localhost, the table prefix defaults to wp_, and the charset defaults to utf8. The command also generates the secret keys and salts for you.

The --dbprefix option sets the table prefix. Use a distinct prefix when two WordPress installs share one database, so their tables do not clash.

If you do not want the command to check the database link, add --skip-check. If you want the password kept out of your shell history, use --prompt=dbpass and type it when asked, as the docs show.

How do you run the install command?

Run wp core install with the site URL, title, admin username, and admin email, and it creates the WordPress tables in seconds.

The wp core install docs state that the command creates the WordPress tables in the database using the URL, title, and default admin user details you give. It performs the famous 5-minute install in seconds or less.

A full install looks like this:

wp core install --url=example.com --title=Example --admin_user=supervisor --admin_password=strongpass [email protected]

On success, the tool prints “Success: WordPress installed successfully.” If you leave out the admin password, the command generates a random one for you.

OptionWhat it sets
--urlThe address of the new site
--titleThe site title
--admin_userThe admin username
--admin_emailThe admin email address
--localeThe install language, default en_US
--skip-emailNo email notice to the new admin

To keep the password out of your shell history, leave --admin_password off and use --prompt=admin_password instead, as the docs show. Add --skip-email if you do not want WordPress to send a notice to the new admin.

The --locale option sets the install language, such as de_DE for German. It defaults to en_US, as the wp core install docs state.

If WordPress lives in a subfolder, run wp option update siteurl after the install, as the docs note. The guide to migrating WordPress with WP-CLI shows the same command style for moving a site.

How do you check the install worked?

Run wp core version, open the site in a browser, and log in at yourdomain.com/wp-admin/.

The version command prints the installed release, such as 7.1.5, the current release as of November 2026. You can also run wp option get siteurl to confirm the site address is right.

Open the domain in a browser and check that the front page loads. The default theme and the “Hello world!” post should show. Then log in to the dashboard and check that the admin user you created has full rights.

The guide to checking your PHP version on your host shows how to confirm the server side.

The guide to WordPress hosting requirements lists the versions WordPress needs.

How do you install WordPress in a subfolder with WP-CLI?

Run wp core install with the subfolder URL, then update the site URL with wp option update siteurl.

The wp core install docs note that if you installed WordPress in a subdirectory, you need to run wp option update siteurl after wp core install. For example, if WordPress is in the /wp folder and your domain is example.com, run:

wp option update siteurl http://example.com/wp

Without that step, links and admin pages can point at the wrong address. The same note applies to installs done by hand, where the fix is in Settings, then General.

How do you update WordPress with WP-CLI after the install?

Run wp core update to move to the latest release, or add --minor to stay on minor releases only.

The wp core update docs state that the command defaults to updating WordPress to the latest version. On success it prints “Success: WordPress updated successfully.”

Useful options include --version to pick a set release, and --minor to update only within the same minor line, such as from 7.1 to 7.1.5. The docs also note that a stuck update can leave a lock behind, cleared with wp option delete core_updater.lock once you have checked that no update is still running.

What mistakes should you avoid?

Do not run wp commands as root, do not put passwords in shell history, and do not install into a folder that already holds files.

Other mistakes to avoid:

  • Running wp core download in a folder that already has a site in it, which can mix two installs together.
  • Typing the admin password on the command line, where it lands in shell history.
  • Forgetting the siteurl update after an install in a subfolder, which leaves links pointing at the wrong place.
  • Skipping wp config create and then wondering why wp core install cannot find the database.
  • Using a weak admin password, or one reused from another site.

The current release as of November 2026 is WordPress 7.1.5, released on November 18, 2026, according to WordPress.org's versions page. Run wp core version after each install so you know which release you are on.

Frequently asked questions

What does WP-CLI need to run?

WP-CLI needs PHP 7.2.24 or later, and it has no extra needs beyond those of WordPress itself. You also need SSH access to your server, which many shared hosts block, so check with your host first.

How do I install WP-CLI itself?

Download the wp-cli.phar file, mark it executable with chmod +x, and move it to a folder on your PATH, such as /usr/local/bin/wp. Run wp --info to check that it works.

How do I download WordPress with WP-CLI?

Run wp core download in the folder where the site should live. It fetches and extracts the latest WordPress files, checks the download against its md5 hash, and caches it for later use.

Must I put the admin password in the command?

No. If you leave out --admin_password, the command generates a random password for the admin user. You can also use --prompt=admin_password to type it when asked, so it stays out of your shell history.

What if I install WordPress in a subfolder with WP-CLI?

Run wp option update siteurl after the install, with the subfolder address. Without that step, links and admin pages can point at the wrong address.

Sources

  1. Installing WP-CLI Make WordPress CLI
  2. wp core install WordPress Developer Resources
  3. wp core download WordPress Developer Resources
  4. wp config create WordPress Developer Resources
  5. WordPress Versions WordPress.org
  6. PHP: Supported Versions PHP

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.