Complete Guide to Installing WordPress Plugins with WP-CLI

In previous tutorials, we've covered theHow to Install WP-CLI on Linux Server. Today, we will focus on how to use the WP-CLI to install the WordPress Plug-ins.

Image [1] - Complete guide to installing and managing WordPress plugins using WP-CLI

Installing WordPress Plugins with WP-CLI

Before proceeding, it is important to note that this tutorial only applies to the tutorials available via the WordPress The plugins provided by the repository are installed. If you need to install the plugin in zip package form, please refer to the subsequent article.

Let's get started! Here's what you can do with WP-CLI A few steps to install the WordPress plugin:

1. Open the WordPress installation directory

First, you need to go to your WordPress installation directory. If you're using cPanel, your WordPress installation directory is usually located at public_html folder. However, we are not using cPanel in this tutorial, so the installation directory may be different.

Image [2] - Complete guide to installing and managing WordPress plugins using WP-CLI

Assuming your installation directory is in the public_htmlYou can use the cd command into the installation directory:

cd public_html

2. Get the Slug (plug-in identifier) of the plug-in

In order to install the plugin, you need to get the plugin's slug. you can search for the plugin in the terminal using the following command:

wp plugin search

For example, if you want to install the Performance Lab plugin, you can run the following command:

wp plugin search performance-lab

After executing the command, you will see results similar to the following:

Image [3] - Complete guide to installing and managing WordPress plugins using WP-CLI

If you can't find the plugin by searching for it, you can also find it directly from the WordPress Plugin Official Website Get the slug of the plugin. e.g.Performance Lab The slug for the plugin is performance-labThe

3. Using WP-CLI to install plug-ins

Once you are in the WordPress installation directory, you can use the following command to install the plugin:

wp plugin install

For example, installing the Performance Lab The commands for the plug-in are as follows:

wp plugin install performance-lab
Image [4] - Complete guide to installing and managing WordPress plugins using WP-CLI

After successfully installing the plugin, the terminal will output something similar to the following:

Installing Performance Lab (1.3.0)...
Download complete.
Installing the plugin...
Plugin installed successfully.

If you want to install more than one plugin at a time, you can add more than one plugin slug to the command, for example:

wp plugin install litespeed-cache w3-total-cache wp-optimize
Image [5] - Complete guide to installing and managing WordPress plugins using WP-CLI

4. Enabling plug-ins

After installing the plugin, you need to enable the plugin. You can use the following command to enable the plugin:

wp plugin activate

For example, enabling the Performance Lab The command for the plugin is:

wp plugin activate performance-lab

After successfully enabling the plugin, the terminal will display something similar to the following:

Plugin 'performance-lab' activated.
Image [6] - Complete guide to installing and managing WordPress plugins using WP-CLI

Alternatively, you can enable the plugin directly when installing it, simply by adding the --activate Parameters:

wp plugin install wp-fastest-cache --activate
Image [7] - Complete guide to installing and managing WordPress plugins using WP-CLI

5. Check plug-in status

If you want to confirm that the plugin was successfully installed and enabled, you can use the WP-CLI to see the plugin status.

Command that lists all plugins:

wp plugin list

If you only want to see the currently enabled plugins, you can use the following command:

wp plugin list --status=active

If you want to see what plugins are currently disabled:

wp plugin list --status=inactive

If you only care about the plugin you just installed, such as the Performance Lab, you can use the following command to check its status:

wp plugin status performance-lab

When you execute the command, you will see output similar to the following:

Image [8] - Complete guide to installing and managing WordPress plugins using WP-CLI

This way, you can verify that the plugin is installed and successfully enabled.

summarize

With this tutorial, you learned how to use WP-CLI Installation, activation, and checking WordPress The status of the plugin. This approach simplifies the plugin management process and is especially suitable for developers who prefer to manage WordPress from the command line.

If you are interested in other WP-CLI commands, or want to learn more about plugin management, you can view the help information with the following commands:

wp plugin

or

wp help plugin

I hope this tutorial was helpful!


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
Customer Service
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by: thieves will be rats and mice courage
THE END
If you like it, support it.
kudos8212 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments