📅  最后修改于: 2023-12-03 14:49:19.974000             🧑  作者: Mango
WP-CLI 是一套基于 Shell-Bash 命令行的 WordPress 管理工具,可以帮助开发人员和管理员更加高效和便捷地管理 WordPress 网站。
本文将介绍如何使用 wp-cli 安装 wp。wp 是一个 Shell 命令,它将 WordPress 安装配置文件打包成一个 PHAR 文件,并提供了一系列方便的命令来管理 WordPress 网站。
使用 wp 必须先安装 wp-cli 工具,推荐通过 Composer 进行安装:
$ curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
$ php wp-cli.phar --info
如果返回版本信息则说明安装成功。
使用 wp-cli 工具安装 wp,只需要在命令行中输入以下命令即可:
$ wp package install aaemnnosttv/wp-cli-dotenv-command:^2.0
安装完成后,就可以在命令行中使用 wp 命令了:
$ wp
返回以下信息:
usage: wp <command>
See 'wp help <command>' for more information on a specific command.
Available commands:
cli Manage WP-CLI itself.
config Manage a site's wp-config.php file.
core Download, install, update and manage a WordPress installation.
db Perform database operations.
eval Execute arbitrary PHP code after loading WordPress.
help Get help on a certain command.
language Install, activate, and manage language packs.
media Import media from given URL or local file.
option Access WordPress options.
package Update individual packages to latest version.
plugin Manage plugins.
post Manage posts.
post-type Manage custom post types.
rewrite Manage rewrite rules.
role Manage user roles.
scaffold Generate files for a new command, or extend WP-CLI with custom functionality.
search-replace Search/replace strings in the database.
server Launch PHP's built-in web server for the WP root directory.
shell Interactive PHP console.
sidebar Manage sidebars.
site Create, update, delete, and manage sites.
super-admin List, add, or remove super admins from a network.
taxonomy Manage taxonomies.
term Manage terms.
theme Manage themes.
transient Manage transients.
user Manage users.
widget Manage sidebar widgets.
See 'wp help <command>' for more information on a specific command.
使用 wp,可以方便地管理 WordPress 网站,例如:
wp core download
wp core update
wp plugin install
wp theme install
wp db import
更多详细命令请使用 wp help
查看帮助文档。
通过 wp-cli 安装 wp,可以更加高效、便捷地管理 WordPress 网站。使用 wp-cli 工具,可以快速地安装、配置、更新 WordPress,以及管理插件、主题等内容。请开发人员和管理员积极使用,来提高工作效率。