Home >Backend Development >PHP Tutorial >How to Install WordPress and Essential Plugins Using WP-CLI

How to Install WordPress and Essential Plugins Using WP-CLI

王林
王林Original
2024-08-10 22:30:33474browse

How to Install WordPress and Essential Plugins Using WP-CLI

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.

Step 1: Download WordPress Core

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

Step 2: Create the Configuration File

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

Step 3: Create the Database

Now, create the database using the following command:

wp db create

Step 4: Install WordPress

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

Step 5: Install and Activate Plugins

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

All-in-One Command Sequence

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn