WordPress WP-CLI 2 cheatsheet

WordPress WP-CLI 2: Setup

7 common WordPress WP-CLI 2 tasks.

Check your WP-CLI setup

Show the WP-CLI, PHP and OS versions and where the config files are.

wp cli info

Download WordPress

Download the latest WordPress files into the current folder.

wp core download

Create wp-config.php

Write wp-config.php with your database details. Use real credentials.

wp config create --dbname=wordpress --dbuser=wp_user --dbpass=change-me --dbhost=localhost

Create the database

Create the database named in wp-config.php.

wp db create

Install WordPress

Run the installer: create tables, the first admin user and the site title.

wp core install --url=https://example.test --title="My Site" --admin_user=admin --admin_password=change-me --admin_email=[email protected]

Check the WordPress version

Print the installed WordPress version.

wp core version

Start a local server

Serve the site with PHP's built-in web server for local development.

wp server

Was this page helpful?