Full tutorial on installing plugins and theme zip files using WP-CLI

exist WordPress In the course of development or maintenance, we often come across premium plugins or themes from third parties, which usually start as .zip Instead of getting them directly from the official wordpress.org repositories, the zip files are provided in the form of files. In this case, installing these zip files with the help of WP-CLI will be much more efficient.

In this article, we will explain in detail how to use the WP-CLI The complete process of installing plugins and themes in local or remote zip file format.

图片[1]-使用 WP-CLI 安装 WordPress 插件和主题 ZIP 文件教程

Prerequisites: WP-CLI installed on the server

Before you start, please make sure that WP-CLI is installed in your server environment. if it is not, please refer to another article: [How to Install WP-CLI on Linux]

Step 1: Go to the WordPress installation directory

First, use the terminal (CLI) to go to the WordPress installation directory. For example, if your site is located:

web/wpgan.tld/public_html

The catalog can be accessed using the following command:

cd web/wpgan.tld/public_html
图片[2]-使用 WP-CLI 安装 WordPress 插件和主题 ZIP 文件教程

Step 2: Create a temporary folder for storing the zip file

After entering the WordPress root directory, it is recommended to create a temporary folder (e.g. tmp) to store the downloaded zip file:

mkdir tmp
cd tmp
图片[3]-使用 WP-CLI 安装 WordPress 插件和主题 ZIP 文件教程

Step 3: Add the plugin or theme zip file

You can use the wget,curl maybe FTP Upload by placing the zip file in the folder. Example:

Add plugin (Ezsha plugin):

wget https://github.com/mnasikin/Ezsha/archive/refs/heads/main.zip

Add theme (Hello Elementor example):

wget https://downloads.wordpress.org/theme/astra.4.7.0.zip

After the download is complete, you can use the ls command to confirm that the zip file was downloaded successfully:

ls
图片[4]-使用 WP-CLI 安装 WordPress 插件和主题 ZIP 文件教程

Step 4: Install the plugin or theme zip file

Return to the WordPress installation directory:

cd ...

Installation of plug-ins

wp plugin install tmp/main.zip

If you wish to enable the plugin directly after installation, you can add the --activate Parameters:

wp plugin install tmp/main.zip --activate

Install Theme

commander-in-chief (military) plugin Replace with theme Ready to go:

wp theme install tmp/astra.4.7.0.zip --activate

After successful installation, the terminal will return a message indicating that the plugin or theme has been installed and activated correctly.

图片[5]-使用 WP-CLI 安装 WordPress 插件和主题 ZIP 文件教程

summarize

utilization WP-CLI Installing plugins and themes in zip format is efficient, clean and suitable for developers and project management in VPS environments. If you want to install plugins or themes directly from the official WordPress repositories, you can also read our other tutorials:


Contact Us
Can't read the tutorial? Contact us for a free answer! Free help for personal, small business sites!
客服微信
Customer Service
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: [email protected]
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
本文作者:托尼屎大颗
THE END
If you like it, support it.
kudos1021 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments