Have you ever wanted to install or update multiple WordPress plugins in batches at once?

In this tutorial, we will Install multiple plugins using WP-CLI From the command line interface.We will show you how Use WP-CLI to manage your plugins, like Update multiple plugins, Activate/deactivate plugin And delete (Uninstall) Plug-in batch -No need to log in to your WordPress site!

Before we start, let’s discuss some prerequisites:

  1. If you use WordPress on a shared hosting provider, your host must provide SSH access and have WP-CLI installed. You can check the official WordPress List Supported hosting, but as it happens, all our recommendations for the best WordPress hosting come with WP-CLI pre-installed.
  2. If you are hosting WordPress in a VPS or cloud server, we will show you how to install WP-CLI in your server later in this tutorial. (PS: If you want to learn how to install WordPress in VPS, please follow our DigitalOcean tutorial)
  3. Your operating system should be a UNIX-like environment (Linux, OS X, FreeBSD); you must have PHP 5.4+ and WordPress 3.7 or higher. Since almost all recommended WordPress hosts meet these standards, you can start using it.
  4. Finally, this tutorial is no For beginners. Those familiar with the command line interface (CLI) and server management should use this tutorial.

let’s start.

What is WP-CLI in WordPress?

Command line tool It is a free and open source project that allows you to manage your WordPress site using the command line interface (CLI). WP-CLI greatly simplifies many WordPress tasks, such as installing WordPress, backing up databases, updating WordPress core, and installing or updating WordPress plugins and themes.

All of this can be done by entering some commands in the terminal without having to log in to your WordPress site. result? Save a lot of time, reduce the room for error and increase productivity!This is an Good primer from WPShout Learn more about WP-CLI.

How to install WP-CLI in WordPress VPS or cloud server?

Users who have installed WordPress Virtual private network (E.g. DigitalOcean), one Cloud hosting provider (E.g. Amazon Web Services (AWS) or Google Cloud), or Managed cloud hosting (Such as CloudWays), you can install WP-CLI in their server.

notes: In this tutorial, we used Vultr VPS (similar to DigitalOcean droplet) with WordPress pre-installed, and referred to Official documentation.

step 1: Log in to your server root user. If you do not have access to the root user, please click in “/var/www/html” contents.

Step 2: download wp-cli.phar File usage Obtain or curly (We used cURL):

Install wp-cli for wordpress in vps or cloud server

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Step 3: Verify that the Phar file is working properly. Enter the following command and you should see similar output:

Install wp-cli wordpress vps-check --info

php wp-cli.phar --info

the fourth step: We want to execute WP-CLI from the command line by typing noob. To do this, we need to make the WP-CLI file executable and move it to garbage can contents.

Install wp-cli wordpress vps-move to bin and exec permissions

  • To make the WP-CLI file executable, type:
chmod +x wp-cli.phar
  • Next, move it to the bin directory:
sudo mv wp-cli.phar /usr/local/bin/wp

Step 5: Now we will test whether WP-CLI can execute correctly:

Install wp-cli wordpress vps installation check work

  • First, change the working directory to the WordPress installation directory:
cd /var/www/html
  • Next, run the following command and you should see output similar to the screenshot above.
wp --info

Note: Root access error in WP-CLI and solutions

Sometimes, when you use the WP-CLI command as root Users, you may receive the following error:

wp-cli root access error wordpress vps

In this case, just attach – Allow root To the order, you are glad to go. This is an example of the command to test whether WP-CLI recognizes an existing WordPress installation.

wp core version --allow-root

wp-cli root access error solving wordpress

After completing this operation, you can install the plug-ins in batches.

How to install multiple plugins in batches in WordPress using WP-CLI

In this section, we will show you how to install multiple plugins in WordPress in batches from the command line interface using WP-CLI.For reference, keep the official WP-CLI plugin documentation convenient.

The basic plug-in installation commands are as follows:

wp plugin install PLUGIN_NAME

Code to install Multiple plugins Yes: (You can add as many plugins as you need)

wp plugin install PLUGIN_1_NAME PLUGIN_2_NAME PLUGIN_3_NAME

Now, the trick is Find out the correct name of the plug-in. To do this, visit the URL page of the plugin and copy the URL slug.

  • For example, the Jetpack plugin URL is https://wordpress.org/plugins/Jetpack/
    • So the plugin name is Jetpack
  • Similarly, for the Yoast SEO plugin, the URL is https://wordpress.org/plugins/wordpress-seo/
    • So the plugin name is wordpress-seo

To install a single plugin, the code is:

wp plugin install jetpack

To install Jetpack and Yoast SEO at the same time, the code is:

wp plugin install jetpack wordpress-seo

wp-cli install multiple plugins in wordpress

(Please note that we have used – Allow root To ensure that the code runs in our VPS. )

How to install and activate multiple plugins in WordPress using WP-CLI

By default, the plug-in installed by WP-CLI is not activated.If you want to activate the plugin immediately after installation, please attach -Enable To the order.

However, we recommend not to activate the Entry configuration (Such as cache and backup plugins), directly from WP-CLI.

Plug-ins that do not need to load configuration, for example Insert header and footer It can be activated from the command line:

wp plugin install insert-headers-and-footers --activate

wp-cli install and activate multiple plugins in wordpress

That’s it! Now you know how to install and activate multiple plugins in batches using WP-CLI.In the next section, we will teach you Plug-in management using WP-CLI.

Bulk plugin management in WordPress WP-CLI

You can use WP-CLI for various plugin management tasks, such as:

  • List the number of installed plugins
  • Multiple plugin activation/deactivation
  • Batch update and delete plugins

How to use WP-CLI to list the number of installed plugins in WordPress

This command displays the number of installed plugins in the WordPress site in a table, including important information such as the activation status of the plugin, current version, and available updates (if any).

wp plugin list

wp-cli lists all installed plugins in wordpress

How to use WP-CLI to activate or deactivate multiple plugins at once

Similar to the plug-in installation command, add the name of the plug-in to be activated or deactivated, and then press Enter.

wp plugin activate PLUGIN_1_NAME PLUGIN_2_NAME

Therefore, the command to activate Yoast SEO and Jetpack (assuming they are installed) is:

wp plugin activate wordpress-seo jetpack

Similarly, the command to disable (or disable) the two plugins is:

wp plugin deactivate wordpress-seo jetpack

Or you can Disable all active plugins Use the following command in your WordPress website:

wp plugin deactivate --all

wp-cli disable all plugins in wordpress from the command line

How to use WP-CLI to batch update multiple plugins in WordPress

Another useful application of WP-CLI is its ability to batch update all installed plugins in the WordPress site. The command is:

wp plugin update --all

    wp-cli updates all plugins in wordpress from the command line

wrap up

In addition to plug-in maintenance, Command line tool Is a powerful tool that allows you to execute Lots of maintenance tasks Very efficient, save a lot of precious time for you through the command line.

If you are trying WP-CLI for the first time, we recommend that you do this on a temporary server or a new WordPress instance. Once you are familiar with the tool, you can start using it in your live site.

Hope you learned something new from this tutorial. Have you used WP-CLI before? What is your favorite technique?