Setting up a WordPress site can be time-consuming if done manually, but with WP-CLI, the process becomes much faster and more efficient. In this tutorial, I'll show you how to install WordPress along with a few essential plugins using a single command sequence.
First, you'll need to download the WordPress core files. This command will download WordPress to a directory called mywebsite.
wp core download --path=mywebsite
Navigate into the newly created mywebsite directory, and create the wp-config.php file with your database credentials:
cd mywebsite wp config create --dbname=silk --dbuser=root --dbpass=root
Now, create the database using the following command:
wp db create
Install WordPress using your local URL, site title, and admin credentials:
wp core install --url=mywebsite.test --title="Site Title" --admin_user=admin --admin_password=admin --admin_email=mywebsite@welabs.dev
Finally, install and activate the necessary plugins. In this example, we'll install WooCommerce and Dokan Lite:
wp plugin install woocommerce --activate wp plugin install dokan-lite --activate
For your convenience, here’s the entire process in one continuous block of code. Just copy and paste the code below into your terminal to install WordPress and a few plugins with a single command.
wp core download --path=mywebsite cd mywebsite wp config create --dbname=silk --dbuser=root --dbpass=root wp db create wp core install --url=mywebsite.test --title="Site Title" --admin_user=admin --admin_password=admin --admin_email=mywebsite@welabs.dev wp plugin install woocommerce --activate wp plugin install dokan-lite --activate
Prerequisite:Install WP-CLI to you machine.
The above is the detailed content of How to Install WordPress and Essential Plugins Using WP-CLI. For more information, please follow other related articles on the PHP Chinese website!