管理外掛和主題,包括安裝、啟用和更新。
快速連結:使用 |安裝 |貢獻 |支援
該包實現了以下命令:
管理插件,包括安裝、啟用和更新。
wp plugin
有關插件的更多信息,請參閱 WordPress 插件手冊開發人員資源。
例子
# Activate plugin
$ wp plugin activate hello
Plugin 'hello' activated.
Success: Activated 1 of 1 plugins.
# Deactivate plugin
$ wp plugin deactivate hello
Plugin 'hello' deactivated.
Success: Deactivated 1 of 1 plugins.
# Delete plugin
$ wp plugin delete hello
Deleted 'hello' plugin.
Success: Deleted 1 of 1 plugins.
# Install the latest version from wordpress.org and activate
$ wp plugin install bbpress --activate
Installing bbPress (2.5.9)
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zip...
Using cached file '/home/vagrant/.wp-cli/cache/plugin/bbpress-2.5.9.zip'...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'bbpress'...
Plugin 'bbpress' activated.
Success: Installed 1 of 1 plugins.
啟動一個或多個外掛程式。
wp plugin activate [...] [--all] [--exclude=] [--network]
選項
[...]
One or more plugins to activate.
[--all]
If set, all plugins will be activated.
[--exclude=]
Comma separated list of plugin slugs to be excluded from activation.
[--network]
If set, the plugin will be activated for the entire multisite network.
例子
# Activate plugin
$ wp plugin activate hello
Plugin 'hello' activated.
Success: Activated 1 of 1 plugins.
# Activate plugin in entire multisite network
$ wp plugin activate hello --network
Plugin 'hello' network activated.
Success: Network activated 1 of 1 plugins.
# Activate plugins that were recently active.
$ wp plugin activate $(wp plugin list --recently-active --field=name)
Plugin 'bbpress' activated.
Plugin 'buddypress' activated.
Success: Activated 2 of 2 plugins.
# Activate plugins that were recently active on a multisite.
$ wp plugin activate $(wp plugin list --recently-active --field=name) --network
Plugin 'bbpress' network activated.
Plugin 'buddypress' network activated.
Success: Activated 2 of 2 plugins.
停用一個或多個插件。
wp plugin deactivate [...] [--uninstall] [--all] [--exclude=] [--network]
選項
[...]
One or more plugins to deactivate.
[--uninstall]
Uninstall the plugin after deactivation.
[--all]
If set, all plugins will be deactivated.
[--exclude=]
Comma separated list of plugin slugs that should be excluded from deactivation.
[--network]
If set, the plugin will be deactivated for the entire multisite network.
例子
# Deactivate plugin
$ wp plugin deactivate hello
Plugin 'hello' deactivated.
Success: Deactivated 1 of 1 plugins.
# Deactivate all plugins with exclusion
$ wp plugin deactivate --all --exclude=hello,wordpress-seo
Plugin 'contact-form-7' deactivated.
Plugin 'ninja-forms' deactivated.
Success: Deactivated 2 of 2 plugins.
刪除插件檔案而不停用或卸載。
wp plugin delete [...] [--all] [--exclude=]
選項
[...]
One or more plugins to delete.
[--all]
If set, all plugins will be deleted.
[--exclude=]
Comma separated list of plugin slugs to be excluded from deletion.
例子
# Delete plugin
$ wp plugin delete hello
Deleted 'hello' plugin.
Success: Deleted 1 of 1 plugins.
# Delete inactive plugins
$ wp plugin delete $(wp plugin list --status=inactive --field=name)
Deleted 'tinymce-templates' plugin.
Success: Deleted 1 of 1 plugins.
# Delete all plugins excluding specified ones
$ wp plugin delete --all --exclude=hello-dolly,jetpack
Deleted 'akismet' plugin.
Deleted 'tinymce-templates' plugin.
Success: Deleted 2 of 2 plugins.
取得已安裝插件的詳細資訊。
wp plugin get [--field=] [--fields=] [--format=]
選項
The plugin to get.
[--field=]
Instead of returning the whole plugin, returns the value of a single field.
[--fields=]
Limit the output to specific fields. Defaults to all fields.
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- yaml
---
可用領域
插件預設顯示這些字段:
這些字段是可選的:
例子
# Get plugin details.
$ wp plugin get bbpress --format=json
{"name":"bbpress","title":"bbPress","author":"The bbPress Contributors","version":"2.6.9","description":"bbPress is forum software with a twist from the creators of WordPress.","status":"active"}
安裝一個或多個插件。
wp plugin install ... [--version=] [--force] [--activate] [--activate-network] [--insecure]
選項
...
One or more plugins to install. Accepts a plugin slug, the path to a local zip file, or a URL to a remote zip file.
[--version=]
If set, get that particular version from wordpress.org, instead of the
stable version.
[--force]
If set, the command will overwrite any installed version of the plugin, without prompting
for confirmation.
[--activate]
If set, the plugin will be activated immediately after install.
[--activate-network]
If set, the plugin will be network activated immediately after install
[--insecure]
Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
例子
# Install the latest version from wordpress.org and activate
$ wp plugin install bbpress --activate
Installing bbPress (2.5.9)
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zip...
Using cached file '/home/vagrant/.wp-cli/cache/plugin/bbpress-2.5.9.zip'...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'bbpress'...
Plugin 'bbpress' activated.
Success: Installed 1 of 1 plugins.
# Install the development version from wordpress.org
$ wp plugin install bbpress --version=dev
Installing bbPress (Development Version)
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.
# Install from a local zip file
$ wp plugin install ../my-plugin.zip
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.
# Install from a remote zip file
$ wp plugin install http://s3.amazonaws.com/bucketname/my-plugin.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
Downloading install package from http://s3.amazonaws.com/bucketname/my-plugin.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.
# Update from a remote zip file
$ wp plugin install https://github.com/envato/wp-envato-market/archive/master.zip --force
Downloading install package from https://github.com/envato/wp-envato-market/archive/master.zip
Unpacking the package...
Installing the plugin...
Renamed Github-based project from 'wp-envato-market-master' to 'wp-envato-market'.
Plugin updated successfully
Success: Installed 1 of 1 plugins.
# Forcefully re-install all installed plugins
$ wp plugin install $(wp plugin list --field=name) --force
Installing Akismet (3.1.11)
Downloading install package from https://downloads.wordpress.org/plugin/akismet.3.1.11.zip...
Unpacking the package...
Installing the plugin...
Removing the old version of the plugin...
Plugin updated successfully
Success: Installed 1 of 1 plugins.
檢查是否安裝了給定的插件。
wp plugin is-installed
安裝時返回退出代碼 0,卸載時返回退出代碼 1。
選項
The plugin to check.
例子
# Check whether plugin is installed; exit status 0 if installed, otherwise 1
$ wp plugin is-installed hello
$ echo $?
1
取得插件列表。
wp plugin list [--=] [--field=] [--fields=] [--format=] [--status=] [--skip-update-check] [--recently-active]
顯示網站上安裝的插件清單以及啟用狀態、是否有可用更新等。
使用--status=dropin
列出已安裝的 dropins(例如object-cache.php
)。
選項
[--=]
Filter results based on the value of a field.
[--field=]
Prints the value of a single field for each plugin.
[--fields=]
Limit the output to specific object fields.
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- count
- json
- yaml
---
[--status=]
Filter the output by plugin status.
---
options:
- active
- active-network
- dropin
- inactive
- must-use
---
[--skip-update-check]
If set, the plugin update check will be skipped.
[--recently-active]
If set, only recently active plugins will be shown and the status filter will be ignored.
可用領域
預設情況下,每個插件都會顯示這些欄位:
這些字段是可選的:
例子
# List active plugins on the site.
$ wp plugin list --status=active --format=json
[{"name":"dynamic-hostname","status":"active","update":"none","version":"0.4.2","update_version":"","auto_update":"off"},{"name":"tinymce-templates","status":"active","update":"none","version":"4.8.1","update_version":"","auto_update":"off"},{"name":"wp-multibyte-patch","status":"active","update":"none","version":"2.9","update_version":"","auto_update":"off"},{"name":"wp-total-hacks","status":"active","update":"none","version":"4.7.2","update_version":"","auto_update":"off"}]
# List plugins on each site in a network.
$ wp site list --field=url | xargs -I % wp plugin list --url=%
+---------+----------------+-----------+---------+-----------------+------------+
| name | status | update | version | update_version | auto_update |
+---------+----------------+-----------+---------+----------------+-------------+
| akismet | active-network | none | 5.3.1 | | on |
| hello | inactive | available | 1.6 | 1.7.2 | off |
+---------+----------------+-----------+---------+----------------+-------------+
+---------+----------------+-----------+---------+----------------+-------------+
| name | status | update | version | update_version | auto_update |
+---------+----------------+-----------+---------+----------------+-------------+
| akismet | active-network | none | 5.3.1 | | on |
| hello | inactive | available | 1.6 | 1.7.2 | off |
+---------+----------------+-----------+---------+----------------+-------------+
# Check whether plugins are still active on WordPress.org
$ wp plugin list --fields=name,wporg_status,wporg_last_updated
+--------------------+--------------+--------------------+
| name | wporg_status | wporg_last_updated |
+--------------------+--------------+--------------------+
| akismet | active | 2023-12-11 |
| user-switching | active | 2023-11-17 |
| wordpress-importer | active | 2023-04-28 |
| local | | |
+--------------------+--------------+--------------------+
# List recently active plugins on the site.
$ wp plugin list --recently-active --field=name --format=json
["akismet","bbpress","buddypress"]
取得插件或插件目錄的路徑。
wp plugin path [] [--dir]
選項
[]
The plugin to get the path to. If not set, will return the path to the
plugins directory.
[--dir]
If set, get the path to the closest parent directory, instead of the
plugin file.
例子
$ cd $(wp plugin path) && pwd
/var/www/wordpress/wp-content/plugins
搜尋 WordPress.org 外掛目錄。
wp plugin search [--page=] [--per-page=] [--field=] [--fields=] [--format=]
顯示 WordPress.org 外掛程式目錄中與給定搜尋查詢相符的外掛程式。
選項
The string to search for.
[--page=]
Optional page to display.
---
default: 1
---
[--per-page=]
Optional number of results to display.
---
default: 10
---
[--field=]
Prints the value of a single field for each plugin.
[--fields=]
Ask for specific fields from the API. Defaults to name,slug,author_profile,rating. Acceptable values:
**name**: Plugin Name
**slug**: Plugin Slug
**version**: Current Version Number
**author**: Plugin Author
**author_profile**: Plugin Author Profile
**contributors**: Plugin Contributors
**requires**: Plugin Minimum Requirements
**tested**: Plugin Tested Up To
**compatibility**: Plugin Compatible With
**rating**: Plugin Rating in Percent and Total Number
**ratings**: Plugin Ratings for each star (1-5)
**num_ratings**: Number of Plugin Ratings
**homepage**: Plugin Author's Homepage
**description**: Plugin's Description
**short_description**: Plugin's Short Description
**sections**: Plugin Readme Sections: description, installation, FAQ, screenshots, other notes, and changelog
**downloaded**: Plugin Download Count
**last_updated**: Plugin's Last Update
**added**: Plugin's Date Added to wordpress.org Repository
**tags**: Plugin's Tags
**versions**: Plugin's Available Versions with D/L Link
**donate_link**: Plugin's Donation Link
**banners**: Plugin's Banner Image Link
**icons**: Plugin's Icon Image Link
**active_installs**: Plugin's Number of Active Installs
**contributors**: Plugin's List of Contributors
**url**: Plugin's URL on wordpress.org
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- count
- json
- yaml
---
例子
$ wp plugin search dsgnwrks --per-page=20 --format=json
Success: Showing 3 of 3 plugins.
[{"name":"DsgnWrks Instagram Importer Debug","slug":"dsgnwrks-instagram-importer-debug","rating":0},{"name":"DsgnWrks Instagram Importer","slug":"dsgnwrks-instagram-importer","rating":84},{"name":"DsgnWrks Twitter Importer","slug":"dsgnwrks-twitter-importer","rating":80}]
$ wp plugin search dsgnwrks --fields=name,version,slug,rating,num_ratings
Success: Showing 3 of 3 plugins.
+-----------------------------------+---------+-----------------------------------+--------+-------------+
| name | version | slug | rating | num_ratings |
+-----------------------------------+---------+-----------------------------------+--------+-------------+
| DsgnWrks Instagram Importer Debug | 0.1.6 | dsgnwrks-instagram-importer-debug | 0 | 0 |
| DsgnWrks Instagram Importer | 1.3.7 | dsgnwrks-instagram-importer | 84 | 23 |
| DsgnWrks Twitter Importer | 1.1.1 | dsgnwrks-twitter-importer | 80 | 1 |
+-----------------------------------+---------+-----------------------------------+--------+-------------+
顯示一個或所有插件的狀態。
wp plugin status []
選項
[]
A particular plugin to show the status for.
例子
# Displays status of all plugins
$ wp plugin status
5 installed plugins:
I akismet 3.1.11
I easy-digital-downloads 2.5.16
A theme-check 20160523.1
I wen-logo-slider 2.0.3
M ns-pack 1.0.0
Legend: I = Inactive, A = Active, M = Must Use
# Displays status of a plugin
$ wp plugin status theme-check
Plugin theme-check details:
Name: Theme Check
Status: Active
Version: 20160523.1
Author: Otto42, pross
Description: A simple and easy way to test your theme for all the latest WordPress standards and practices. A great theme development tool!
切換插件的啟動狀態。
wp plugin toggle ... [--network]
如果插件處於活動狀態,則它將停用。如果插件處於非活動狀態,那麼它將被啟動。
選項
...
One or more plugins to toggle.
[--network]
If set, the plugin will be toggled for the entire multisite network.
例子
# Akismet is currently activated
$ wp plugin toggle akismet
Plugin 'akismet' deactivated.
Success: Toggled 1 of 1 plugins.
# Akismet is currently deactivated
$ wp plugin toggle akismet
Plugin 'akismet' activated.
Success: Toggled 1 of 1 plugins.
卸載一個或多個插件。
wp plugin uninstall [...] [--deactivate] [--skip-delete] [--all] [--exclude=]
選項
[...]
One or more plugins to uninstall.
[--deactivate]
Deactivate the plugin before uninstalling. Default behavior is to warn and skip if the plugin is active.
[--skip-delete]
If set, the plugin files will not be deleted. Only the uninstall procedure
will be run.
[--all]
If set, all plugins will be uninstalled.
[--exclude=]
Comma separated list of plugin slugs to be excluded from uninstall.
例子
$ wp plugin uninstall hello
Uninstalled and deleted 'hello' plugin.
Success: Uninstalled 1 of 1 plugins.
# Uninstall all plugins excluding specified ones
$ wp plugin uninstall --all --exclude=hello-dolly,jetpack
Uninstalled and deleted 'akismet' plugin.
Uninstalled and deleted 'tinymce-templates' plugin.
Success: Uninstalled 2 of 2 plugins.
更新一個或多個外掛程式。
wp plugin update [...] [--all] [--exclude=] [--minor] [--patch] [--format=] [--version=] [--dry-run] [--insecure]
選項
[...]
One or more plugins to update.
[--all]
If set, all plugins that have updates will be updated.
[--exclude=]
Comma separated list of plugin names that should be excluded from updating.
[--minor]
Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0)
[--patch]
Only perform updates for patch releases (e.g. from 1.3 to 1.3.3 instead of 1.4)
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- summary
---
[--version=]
If set, the plugin will be updated to the specified version.
[--dry-run]
Preview which plugins would be updated.
[--insecure]
Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
例子
$ wp plugin update bbpress --version=dev
Installing bbPress (Development Version)
Downloading install package from https://downloads.wordpress.org/plugin/bbpress.zip...
Unpacking the package...
Installing the plugin...
Removing the old version of the plugin...
Plugin updated successfully.
Success: Updated 1 of 2 plugins.
$ wp plugin update --all
Enabling Maintenance mode...
Downloading update from https://downloads.wordpress.org/plugin/akismet.3.1.11.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
Downloading update from https://downloads.wordpress.org/plugin/nginx-champuru.3.2.0.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
Disabling Maintenance mode...
+------------------------+-------------+-------------+---------+
| name | old_version | new_version | status |
+------------------------+-------------+-------------+---------+
| akismet | 3.1.3 | 3.1.11 | Updated |
| nginx-cache-controller | 3.1.1 | 3.2.0 | Updated |
+------------------------+-------------+-------------+---------+
Success: Updated 2 of 2 plugins.
$ wp plugin update --all --exclude=akismet
Enabling Maintenance mode...
Downloading update from https://downloads.wordpress.org/plugin/nginx-champuru.3.2.0.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the plugin...
Plugin updated successfully.
Disabling Maintenance mode...
+------------------------+-------------+-------------+---------+
| name | old_version | new_version | status |
+------------------------+-------------+-------------+---------+
| nginx-cache-controller | 3.1.1 | 3.2.0 | Updated |
+------------------------+-------------+-------------+---------+
管理主題,包括安裝、啟動和更新。
wp theme
有關主題的更多信息,請參閱 WordPress 主題手冊開發人員資源。
例子
# Install the latest version of a theme from wordpress.org and activate
$ wp theme install twentysixteen --activate
Installing Twenty Sixteen (1.2)
Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the package...
Installing the theme...
Theme installed successfully.
Activating 'twentysixteen'...
Success: Switched to 'Twenty Sixteen' theme.
Success: Installed 1 of 1 themes.
# Get details of an installed theme
$ wp theme get twentysixteen --fields=name,title,version
+---------+----------------+
| Field | Value |
+---------+----------------+
| name | Twenty Sixteen |
| title | Twenty Sixteen |
| version | 1.2 |
+---------+----------------+
# Get status of theme
$ wp theme status twentysixteen
Theme twentysixteen details:
Name: Twenty Sixteen
Status: Active
Version: 1.2
Author: the WordPress team
激活主題。
wp theme activate
選項
The theme to activate.
例子
$ wp theme activate twentysixteen
Success: Switched to 'Twenty Sixteen' theme.
刪除一個或多個主題。
wp theme delete [...] [--all] [--force]
從檔案系統中刪除一個或多個主題。
選項
[...]
One or more themes to delete.
[--all]
If set, all themes will be deleted except active theme.
[--force]
To delete active theme use this.
例子
$ wp theme delete twentytwelve
Deleted 'twentytwelve' theme.
Success: Deleted 1 of 1 themes.
在 WordPress 多站安裝上停用主題。
wp theme disable [--network]
刪除了在 WordPress 多網站安裝上從網站儀表板啟動主題的功能。
選項
The theme to disable.
[--network]
If set, the theme is disabled on the network level. Note that
individual sites may still have this theme enabled if it was
enabled for them independently.
例子
# Disable theme
$ wp theme disable twentysixteen
Success: Disabled the 'Twenty Sixteen' theme.
# Disable theme in network level
$ wp theme disable twentysixteen --network
Success: Network disabled the 'Twenty Sixteen' theme.
在 WordPress 多站安裝上啟用主題。
wp theme enable [--network] [--activate]
允許在 WordPress 多網站安裝上從網站的儀表板啟動主題。
選項
The theme to enable.
[--network]
If set, the theme is enabled for the entire network
[--activate]
If set, the theme is activated for the current site. Note that
the "network" flag has no influence on this.
例子
# Enable theme
$ wp theme enable twentysixteen
Success: Enabled the 'Twenty Sixteen' theme.
# Network enable theme
$ wp theme enable twentysixteen --network
Success: Network enabled the 'Twenty Sixteen' theme.
# Network enable and activate theme for current site
$ wp theme enable twentysixteen --activate
Success: Enabled the 'Twenty Sixteen' theme.
Success: Switched to 'Twenty Sixteen' theme.
取得有關主題的詳細資訊。
wp theme get [--field=] [--fields=] [--format=]
選項
The theme to get.
[--field=]
Instead of returning the whole theme, returns the value of a single field.
[--fields=]
Limit the output to specific fields. Defaults to all fields.
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- yaml
---
例子
$ wp theme get twentysixteen --fields=name,title,version
+---------+----------------+
| Field | Value |
+---------+----------------+
| name | Twenty Sixteen |
| title | Twenty Sixteen |
| version | 1.2 |
+---------+----------------+
安裝一個或多個主題。
wp theme install ... [--version=] [--force] [--activate] [--insecure]
選項
...
One or more themes to install. Accepts a theme slug, the path to a local zip file, or a URL to a remote zip file.
[--version=]
If set, get that particular version from wordpress.org, instead of the
stable version.
[--force]
If set, the command will overwrite any installed version of the theme, without prompting
for confirmation.
[--activate]
If set, the theme will be activated immediately after install.
[--insecure]
Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
例子
# Install the latest version from wordpress.org and activate
$ wp theme install twentysixteen --activate
Installing Twenty Sixteen (1.2)
Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the package...
Installing the theme...
Theme installed successfully.
Activating 'twentysixteen'...
Success: Switched to 'Twenty Sixteen' theme.
Success: Installed 1 of 1 themes.
# Install from a local zip file
$ wp theme install ../my-theme.zip
# Install from a remote zip file
$ wp theme install http://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
檢查是否安裝了給定主題。
wp theme is-installed
安裝時返回退出代碼 0,卸載時返回退出代碼 1。
選項
The theme to check.
例子
# Check whether theme is installed; exit status 0 if installed, otherwise 1
$ wp theme is-installed hello
$ echo $?
1
取得主題清單。
wp theme list [--=] [--field=] [--fields=] [--format=] [--status=] [--skip-update-check]
選項
[--=]
Filter results based on the value of a field.
[--field=]
Prints the value of a single field for each theme.
[--fields=]
Limit the output to specific object fields.
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
- yaml
---
[--status=]
Filter the output by theme status.
---
options:
- active
- parent
- inactive
---
[--skip-update-check]
If set, the theme update check will be skipped.
可用領域
預設情況下,每個主題都會顯示這些欄位:
這些字段是可選的:
例子
# List inactive themes.
$ wp theme list --status=inactive --format=csv
name,status,update,version,update_version,auto_update
twentyfourteen,inactive,none,3.8,,off
twentysixteen,inactive,available,3.0,3.1,off
設定、取得和刪除主題 mod。
wp theme mod
例子
# Set the 'background_color' theme mod to '000000'.
$ wp theme mod set background_color 000000
Success: Theme mod background_color set to 000000.
# Get single theme mod in JSON format.
$ wp theme mod get background_color --format=json
[{"key":"background_color","value":"dd3333"}]
# Remove all theme mods.
$ wp theme mod remove --all
Success: Theme mods removed.
取得一個或多個主題模組。
wp theme mod get [...] [--field=] [--all] [--format=]
選項
[...]
One or more mods to get.
[--field=]
Returns the value of a single field.
[--all]
List all theme mods
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- json
- csv
- yaml
---
例子
# Get all theme mods.
$ wp theme mod get --all
+------------------+---------+
| key | value |
+------------------+---------+
| background_color | dd3333 |
| link_color | #dd9933 |
| main_text_color | #8224e3 |
+------------------+---------+
# Get single theme mod in JSON format.
$ wp theme mod get background_color --format=json
[{"key":"background_color","value":"dd3333"}]
# Get value of a single theme mod.
$ wp theme mod get background_color --field=value
dd3333
# Get multiple theme mods.
$ wp theme mod get background_color header_textcolor
+------------------+--------+
| key | value |
+------------------+--------+
| background_color | dd3333 |
| header_textcolor | |
+------------------+--------+
設定主題 mod 的值。
wp theme mod set
選項
The name of the theme mod to set or update.
The new value.
例子
# Set theme mod
$ wp theme mod set background_color 000000
Success: Theme mod background_color set to 000000.
刪除一個或多個主題模組。
wp theme mod remove [...] [--all]
選項
[...]
One or more mods to remove.
[--all]
Remove all theme mods.
例子
# Remove all theme mods.
$ wp theme mod remove --all
Success: Theme mods removed.
# Remove single theme mod.
$ wp theme mod remove background_color
Success: 1 mod removed.
# Remove multiple theme mods.
$ wp theme mod remove background_color header_textcolor
Success: 2 mods removed.
取得主題或主題目錄的路徑。
wp theme path [] [--dir]
選項
[]
The theme to get the path to. Path includes "style.css" file.
If not set, will return the path to the themes directory.
[--dir]
If set, get the path to the closest parent directory, instead of the
theme's "style.css" file.
例子
# Get theme path
$ wp theme path
/var/www/example.com/public_html/wp-content/themes
# Change directory to theme path
$ cd $(wp theme path)
搜尋 WordPress.org 主題目錄。
wp theme search [--page=] [--per-page=] [--field=] [--fields=] [--format=]
顯示 WordPress.org 主題目錄中與給定搜尋查詢相符的主題。
選項
The string to search for.
[--page=]
Optional page to display.
---
default: 1
---
[--per-page=]
Optional number of results to display. Defaults to 10.
[--field=]
Prints the value of a single field for each theme.
[--fields=]
Ask for specific fields from the API. Defaults to name,slug,author,rating. Acceptable values:
**name**: Theme Name
**slug**: Theme Slug
**version**: Current Version Number
**author**: Theme Author
**preview_url**: Theme Preview URL
**screenshot_url**: Theme Screenshot URL
**rating**: Theme Rating
**num_ratings**: Number of Theme Ratings
**homepage**: Theme Author's Homepage
**description**: Theme Description
**url**: Theme's URL on wordpress.org
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
- yaml
---
例子
$ wp theme search photo --per-page=6
Success: Showing 6 of 203 themes.
+----------------------+----------------------+--------+
| name | slug | rating |
+----------------------+----------------------+--------+
| Photos | photos | 100 |
| Infinite Photography | infinite-photography | 100 |
| PhotoBook | photobook | 100 |
| BG Photo Frame | bg-photo-frame | 0 |
| fPhotography | fphotography | 0 |
| Photo Perfect | photo-perfect | 98 |
+----------------------+----------------------+--------+
顯示一個或所有主題的狀態。
wp theme status []
選項
[]
A particular theme to show the status for.
例子
$ wp theme status twentysixteen
Theme twentysixteen details:
Name: Twenty Sixteen
Status: Inactive
Version: 1.2
Author: the WordPress team
更新一個或多個主題。
wp theme update [...] [--all] [--exclude=] [--minor] [--patch] [--format=] [--version=] [--dry-run] [--insecure]
選項
[...]
One or more themes to update.
[--all]
If set, all themes that have updates will be updated.
[--exclude=]
Comma separated list of theme names that should be excluded from updating.
[--minor]
Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0)
[--patch]
Only perform updates for patch releases (e.g. from 1.3 to 1.3.3 instead of 1.4)
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- summary
---
[--version=]
If set, the theme will be updated to the specified version.
[--dry-run]
Preview which themes would be updated.
[--insecure]
Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.
例子
# Update multiple themes
$ wp theme update twentyfifteen twentysixteen
Downloading update from https://downloads.wordpress.org/theme/twentyfifteen.1.5.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
Downloading update from https://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
+---------------+-------------+-------------+---------+
| name | old_version | new_version | status |
+---------------+-------------+-------------+---------+
| twentyfifteen | 1.4 | 1.5 | Updated |
| twentysixteen | 1.1 | 1.2 | Updated |
+---------------+-------------+-------------+---------+
Success: Updated 2 of 2 themes.
# Exclude themes updates when bulk updating the themes
$ wp theme update --all --exclude=twentyfifteen
Downloading update from https://downloads.wordpress.org/theme/astra.1.0.5.1.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
Downloading update from https://downloads.wordpress.org/theme/twentyseventeen.1.2.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the theme...
Theme updated successfully.
+-----------------+----------+---------+----------------+
| name | status | version | update_version |
+-----------------+----------+---------+----------------+
| astra | inactive | 1.0.1 | 1.0.5.1 |
| twentyseventeen | inactive | 1.1 | 1.2 |
+-----------------+----------+---------+----------------+
Success: Updated 2 of 2 themes.
# Update all themes
$ wp theme update --all
取得主題模組清單。
wp theme mod list [--field=] [--format=]
選項
[--field=]
Returns the value of a single field.
[--format=]
Render output in a particular format.
---
default: table
options:
- table
- json
- csv
- yaml
---
例子
# Gets a list of theme mods.
$ wp theme mod list
+------------------+---------+
| key | value |
+------------------+---------+
| background_color | dd3333 |
| link_color | #dd9933 |
| main_text_color | #8224e3 |
+------------------+---------+
該軟體包包含在 WP-CLI 本身中,無需額外安裝。
若要透過 WP-CLI 中包含的內容安裝此軟體包的最新版本,請執行:
wp package install [email protected]:wp-cli/extension-command.git
我們感謝您主動為此專案做出貢獻。
貢獻不僅限於程式碼。我們鼓勵您以最適合您能力的方式做出貢獻,例如編寫教學課程、在本地聚會上進行演示、幫助其他使用者解決支援問題或修改我們的文件。
更全面的介紹,請查看 WP-CLI 的貢獻指南。該軟體包遵循這些政策和準則。
您認為您發現了錯誤嗎?我們希望您能幫助我們解決問題。
在建立新問題之前,您應該搜尋現有問題以查看是否有現有解決方案,或是否已在新版本中修復。
一旦您完成一些搜尋並發現您的錯誤沒有未解決或已修復的問題,請建立一個新問題。包含盡可能多的細節,並儘可能明確重現的步驟。如需更多指導,請查看我們的錯誤報告文件。
想貢獻新功能嗎?請先開啟一個新問題來討論該功能是否適合該專案。
一旦您決定花時間查看您的拉取要求,請遵循我們的建立拉取請求指南,以確保這是一次愉快的體驗。有關在本地處理此包的詳細信息,請參閱“設定”。
GitHub 問題不適用於一般支援問題,但您可以嘗試其他地方:https://wp-cli.org/#support
此 README.md 是使用wp scaffold package-readme
(doc) 從專案的程式碼庫動態產生的。若要提出變更建議,請針對程式碼庫的相應部分提交拉取請求。