项目作者: wp-cli

项目描述 :
Manages plugins and themes, including installs, activations, and updates.
高级语言: PHP
项目地址: git://github.com/wp-cli/extension-command.git
创建时间: 2017-04-04T15:11:21Z
项目社区:https://github.com/wp-cli/extension-command

开源协议:MIT License

下载


wp-cli/extension-command

Manages plugins and themes, including installs, activations, and updates.

Testing

Quick links: Using | Installing | Contributing | Support

Using

This package implements the following commands:

wp plugin

Manages plugins, including installs, activations, and updates.

  1. wp plugin

See the WordPress Plugin Handbook developer resource for more information on plugins.

EXAMPLES

  1. # Activate plugin
  2. $ wp plugin activate hello
  3. Plugin 'hello' activated.
  4. Success: Activated 1 of 1 plugins.
  5. # Deactivate plugin
  6. $ wp plugin deactivate hello
  7. Plugin 'hello' deactivated.
  8. Success: Deactivated 1 of 1 plugins.
  9. # Delete plugin
  10. $ wp plugin delete hello
  11. Deleted 'hello' plugin.
  12. Success: Deleted 1 of 1 plugins.
  13. # Install the latest version from wordpress.org and activate
  14. $ wp plugin install bbpress --activate
  15. Installing bbPress (2.5.9)
  16. Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zip...
  17. Using cached file '/home/vagrant/.wp-cli/cache/plugin/bbpress-2.5.9.zip'...
  18. Unpacking the package...
  19. Installing the plugin...
  20. Plugin installed successfully.
  21. Activating 'bbpress'...
  22. Plugin 'bbpress' activated.
  23. Success: Installed 1 of 1 plugins.

wp plugin activate

Activates one or more plugins.

  1. wp plugin activate [<plugin>...] [--all] [--exclude=<name>] [--network]

OPTIONS

  1. [<plugin>...]
  2. One or more plugins to activate.
  3. [--all]
  4. If set, all plugins will be activated.
  5. [--exclude=<name>]
  6. Comma separated list of plugin slugs to be excluded from activation.
  7. [--network]
  8. If set, the plugin will be activated for the entire multisite network.

EXAMPLES

  1. # Activate plugin
  2. $ wp plugin activate hello
  3. Plugin 'hello' activated.
  4. Success: Activated 1 of 1 plugins.
  5. # Activate plugin in entire multisite network
  6. $ wp plugin activate hello --network
  7. Plugin 'hello' network activated.
  8. Success: Network activated 1 of 1 plugins.
  9. # Activate plugins that were recently active.
  10. $ wp plugin activate $(wp plugin list --recently-active --field=name)
  11. Plugin 'bbpress' activated.
  12. Plugin 'buddypress' activated.
  13. Success: Activated 2 of 2 plugins.
  14. # Activate plugins that were recently active on a multisite.
  15. $ wp plugin activate $(wp plugin list --recently-active --field=name) --network
  16. Plugin 'bbpress' network activated.
  17. Plugin 'buddypress' network activated.
  18. Success: Activated 2 of 2 plugins.

wp plugin deactivate

Deactivates one or more plugins.

  1. wp plugin deactivate [<plugin>...] [--uninstall] [--all] [--exclude=<name>] [--network]

OPTIONS

  1. [<plugin>...]
  2. One or more plugins to deactivate.
  3. [--uninstall]
  4. Uninstall the plugin after deactivation.
  5. [--all]
  6. If set, all plugins will be deactivated.
  7. [--exclude=<name>]
  8. Comma separated list of plugin slugs that should be excluded from deactivation.
  9. [--network]
  10. If set, the plugin will be deactivated for the entire multisite network.

EXAMPLES

  1. # Deactivate plugin
  2. $ wp plugin deactivate hello
  3. Plugin 'hello' deactivated.
  4. Success: Deactivated 1 of 1 plugins.
  5. # Deactivate all plugins with exclusion
  6. $ wp plugin deactivate --all --exclude=hello,wordpress-seo
  7. Plugin 'contact-form-7' deactivated.
  8. Plugin 'ninja-forms' deactivated.
  9. Success: Deactivated 2 of 2 plugins.

wp plugin delete

Deletes plugin files without deactivating or uninstalling.

  1. wp plugin delete [<plugin>...] [--all] [--exclude=<name>]

OPTIONS

  1. [<plugin>...]
  2. One or more plugins to delete.
  3. [--all]
  4. If set, all plugins will be deleted.
  5. [--exclude=<name>]
  6. Comma separated list of plugin slugs to be excluded from deletion.

EXAMPLES

  1. # Delete plugin
  2. $ wp plugin delete hello
  3. Deleted 'hello' plugin.
  4. Success: Deleted 1 of 1 plugins.
  5. # Delete inactive plugins
  6. $ wp plugin delete $(wp plugin list --status=inactive --field=name)
  7. Deleted 'tinymce-templates' plugin.
  8. Success: Deleted 1 of 1 plugins.
  9. # Delete all plugins excluding specified ones
  10. $ wp plugin delete --all --exclude=hello-dolly,jetpack
  11. Deleted 'akismet' plugin.
  12. Deleted 'tinymce-templates' plugin.
  13. Success: Deleted 2 of 2 plugins.

wp plugin get

Gets details about an installed plugin.

  1. wp plugin get <plugin> [--field=<field>] [--fields=<fields>] [--format=<format>]

OPTIONS

  1. <plugin>
  2. The plugin to get.
  3. [--field=<field>]
  4. Instead of returning the whole plugin, returns the value of a single field.
  5. [--fields=<fields>]
  6. Limit the output to specific fields. Defaults to all fields.
  7. [--format=<format>]
  8. Render output in a particular format.
  9. ---
  10. default: table
  11. options:
  12. - table
  13. - csv
  14. - json
  15. - yaml
  16. ---

AVAILABLE FIELDS

These fields will be displayed by default for the plugin:

  • name
  • title
  • author
  • version
  • description
  • status

These fields are optionally available:

  • requires_wp
  • requires_php
  • requires_plugins

EXAMPLES

  1. # Get plugin details.
  2. $ wp plugin get bbpress --format=json
  3. {"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

Installs one or more plugins.

  1. wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--ignore-requirements] [--activate] [--activate-network] [--insecure]

OPTIONS

  1. <plugin|zip|url>...
  2. 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.
  3. [--version=<version>]
  4. If set, get that particular version from wordpress.org, instead of the
  5. stable version.
  6. [--force]
  7. If set, the command will overwrite any installed version of the plugin, without prompting
  8. for confirmation.

[—ignore-requirements]
:If set, the command will install the plugin while ignoring any WordPress or PHP version requirements
specified by the plugin authors.

  1. [--activate]
  2. If set, the plugin will be activated immediately after install.
  3. [--activate-network]
  4. If set, the plugin will be network activated immediately after install
  5. [--insecure]
  6. Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.

EXAMPLES

  1. # Install the latest version from wordpress.org and activate
  2. $ wp plugin install bbpress --activate
  3. Installing bbPress (2.5.9)
  4. Downloading install package from https://downloads.wordpress.org/plugin/bbpress.2.5.9.zip...
  5. Using cached file '/home/vagrant/.wp-cli/cache/plugin/bbpress-2.5.9.zip'...
  6. Unpacking the package...
  7. Installing the plugin...
  8. Plugin installed successfully.
  9. Activating 'bbpress'...
  10. Plugin 'bbpress' activated.
  11. Success: Installed 1 of 1 plugins.
  12. # Install the development version from wordpress.org
  13. $ wp plugin install bbpress --version=dev
  14. Installing bbPress (Development Version)
  15. Downloading install package from https://downloads.wordpress.org/plugin/bbpress.zip...
  16. Unpacking the package...
  17. Installing the plugin...
  18. Plugin installed successfully.
  19. Success: Installed 1 of 1 plugins.
  20. # Install from a local zip file
  21. $ wp plugin install ../my-plugin.zip
  22. Unpacking the package...
  23. Installing the plugin...
  24. Plugin installed successfully.
  25. Success: Installed 1 of 1 plugins.
  26. # Install from a remote zip file
  27. $ wp plugin install http://s3.amazonaws.com/bucketname/my-plugin.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
  28. Downloading install package from http://s3.amazonaws.com/bucketname/my-plugin.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef
  29. Unpacking the package...
  30. Installing the plugin...
  31. Plugin installed successfully.
  32. Success: Installed 1 of 1 plugins.
  33. # Update from a remote zip file
  34. $ wp plugin install https://github.com/envato/wp-envato-market/archive/master.zip --force
  35. Downloading install package from https://github.com/envato/wp-envato-market/archive/master.zip
  36. Unpacking the package...
  37. Installing the plugin...
  38. Renamed Github-based project from 'wp-envato-market-master' to 'wp-envato-market'.
  39. Plugin updated successfully
  40. Success: Installed 1 of 1 plugins.
  41. # Forcefully re-install all installed plugins
  42. $ wp plugin install $(wp plugin list --field=name) --force
  43. Installing Akismet (3.1.11)
  44. Downloading install package from https://downloads.wordpress.org/plugin/akismet.3.1.11.zip...
  45. Unpacking the package...
  46. Installing the plugin...
  47. Removing the old version of the plugin...
  48. Plugin updated successfully
  49. Success: Installed 1 of 1 plugins.

wp plugin is-installed

Checks if a given plugin is installed.

  1. wp plugin is-installed <plugin>

Returns exit code 0 when installed, 1 when uninstalled.

OPTIONS

  1. <plugin>
  2. The plugin to check.

EXAMPLES

  1. # Check whether plugin is installed; exit status 0 if installed, otherwise 1
  2. $ wp plugin is-installed hello
  3. $ echo $?
  4. 1

wp plugin list

Gets a list of plugins.

  1. wp plugin list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--status=<status>] [--skip-update-check] [--recently-active]

Displays a list of the plugins installed on the site with activation
status, whether or not there’s an update available, etc.

Use --status=dropin to list installed dropins (e.g. object-cache.php).

OPTIONS

  1. [--<field>=<value>]
  2. Filter results based on the value of a field.
  3. [--field=<field>]
  4. Prints the value of a single field for each plugin.
  5. [--fields=<fields>]
  6. Limit the output to specific object fields.
  7. [--format=<format>]
  8. Render output in a particular format.
  9. ---
  10. default: table
  11. options:
  12. - table
  13. - csv
  14. - count
  15. - json
  16. - yaml
  17. ---
  18. [--status=<status>]
  19. Filter the output by plugin status.
  20. ---
  21. options:
  22. - active
  23. - active-network
  24. - dropin
  25. - inactive
  26. - must-use
  27. ---
  28. [--skip-update-check]
  29. If set, the plugin update check will be skipped.
  30. [--recently-active]
  31. If set, only recently active plugins will be shown and the status filter will be ignored.

AVAILABLE FIELDS

These fields will be displayed by default for each plugin:

  • name
  • status
  • update
  • version
  • update_version
  • auto_update

These fields are optionally available:

  • update_package
  • update_id
  • title
  • description
  • file
  • author
  • tested_up_to
  • requires
  • requires_php
  • wporg_status
  • wporg_last_updated

EXAMPLES

  1. # List active plugins on the site.
  2. $ wp plugin list --status=active --format=json
  3. [{"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"}]
  4. # List plugins on each site in a network.
  5. $ wp site list --field=url | xargs -I % wp plugin list --url=%
  6. +---------+----------------+-----------+---------+-----------------+------------+
  7. | name | status | update | version | update_version | auto_update |
  8. +---------+----------------+-----------+---------+----------------+-------------+
  9. | akismet | active-network | none | 5.3.1 | | on |
  10. | hello | inactive | available | 1.6 | 1.7.2 | off |
  11. +---------+----------------+-----------+---------+----------------+-------------+
  12. +---------+----------------+-----------+---------+----------------+-------------+
  13. | name | status | update | version | update_version | auto_update |
  14. +---------+----------------+-----------+---------+----------------+-------------+
  15. | akismet | active-network | none | 5.3.1 | | on |
  16. | hello | inactive | available | 1.6 | 1.7.2 | off |
  17. +---------+----------------+-----------+---------+----------------+-------------+
  18. # Check whether plugins are still active on WordPress.org
  19. $ wp plugin list --fields=name,wporg_status,wporg_last_updated
  20. +--------------------+--------------+--------------------+
  21. | name | wporg_status | wporg_last_updated |
  22. +--------------------+--------------+--------------------+
  23. | akismet | active | 2023-12-11 |
  24. | user-switching | active | 2023-11-17 |
  25. | wordpress-importer | active | 2023-04-28 |
  26. | local | | |
  27. +--------------------+--------------+--------------------+
  28. # List recently active plugins on the site.
  29. $ wp plugin list --recently-active --field=name --format=json
  30. ["akismet","bbpress","buddypress"]

wp plugin path

Gets the path to a plugin or to the plugin directory.

  1. wp plugin path [<plugin>] [--dir]

OPTIONS

  1. [<plugin>]
  2. The plugin to get the path to. If not set, will return the path to the
  3. plugins directory.
  4. [--dir]
  5. If set, get the path to the closest parent directory, instead of the
  6. plugin file.

EXAMPLES

  1. $ cd $(wp plugin path) && pwd
  2. /var/www/wordpress/wp-content/plugins

Searches the WordPress.org plugin directory.

  1. wp plugin search <search> [--page=<page>] [--per-page=<per-page>] [--field=<field>] [--fields=<fields>] [--format=<format>]

Displays plugins in the WordPress.org plugin directory matching a given
search query.

OPTIONS

  1. <search>
  2. The string to search for.
  3. [--page=<page>]
  4. Optional page to display.
  5. ---
  6. default: 1
  7. ---
  8. [--per-page=<per-page>]
  9. Optional number of results to display.
  10. ---
  11. default: 10
  12. ---
  13. [--field=<field>]
  14. Prints the value of a single field for each plugin.
  15. [--fields=<fields>]
  16. Ask for specific fields from the API. Defaults to name,slug,author_profile,rating. Acceptable values:
  17. **name**: Plugin Name
  18. **slug**: Plugin Slug
  19. **version**: Current Version Number
  20. **author**: Plugin Author
  21. **author_profile**: Plugin Author Profile
  22. **contributors**: Plugin Contributors
  23. **requires**: Plugin Minimum Requirements
  24. **tested**: Plugin Tested Up To
  25. **compatibility**: Plugin Compatible With
  26. **rating**: Plugin Rating in Percent and Total Number
  27. **ratings**: Plugin Ratings for each star (1-5)
  28. **num_ratings**: Number of Plugin Ratings
  29. **homepage**: Plugin Author's Homepage
  30. **description**: Plugin's Description
  31. **short_description**: Plugin's Short Description
  32. **sections**: Plugin Readme Sections: description, installation, FAQ, screenshots, other notes, and changelog
  33. **downloaded**: Plugin Download Count
  34. **last_updated**: Plugin's Last Update
  35. **added**: Plugin's Date Added to wordpress.org Repository
  36. **tags**: Plugin's Tags
  37. **versions**: Plugin's Available Versions with D/L Link
  38. **donate_link**: Plugin's Donation Link
  39. **banners**: Plugin's Banner Image Link
  40. **icons**: Plugin's Icon Image Link
  41. **active_installs**: Plugin's Number of Active Installs
  42. **contributors**: Plugin's List of Contributors
  43. **url**: Plugin's URL on wordpress.org
  44. [--format=<format>]
  45. Render output in a particular format.
  46. ---
  47. default: table
  48. options:
  49. - table
  50. - csv
  51. - count
  52. - json
  53. - yaml
  54. ---

EXAMPLES

  1. $ wp plugin search dsgnwrks --per-page=20 --format=json
  2. Success: Showing 3 of 3 plugins.
  3. [{"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}]
  4. $ wp plugin search dsgnwrks --fields=name,version,slug,rating,num_ratings
  5. Success: Showing 3 of 3 plugins.
  6. +-----------------------------------+---------+-----------------------------------+--------+-------------+
  7. | name | version | slug | rating | num_ratings |
  8. +-----------------------------------+---------+-----------------------------------+--------+-------------+
  9. | DsgnWrks Instagram Importer Debug | 0.1.6 | dsgnwrks-instagram-importer-debug | 0 | 0 |
  10. | DsgnWrks Instagram Importer | 1.3.7 | dsgnwrks-instagram-importer | 84 | 23 |
  11. | DsgnWrks Twitter Importer | 1.1.1 | dsgnwrks-twitter-importer | 80 | 1 |
  12. +-----------------------------------+---------+-----------------------------------+--------+-------------+

wp plugin status

Reveals the status of one or all plugins.

  1. wp plugin status [<plugin>]

OPTIONS

  1. [<plugin>]
  2. A particular plugin to show the status for.

EXAMPLES

  1. # Displays status of all plugins
  2. $ wp plugin status
  3. 5 installed plugins:
  4. I akismet 3.1.11
  5. I easy-digital-downloads 2.5.16
  6. A theme-check 20160523.1
  7. I wen-logo-slider 2.0.3
  8. M ns-pack 1.0.0
  9. Legend: I = Inactive, A = Active, M = Must Use
  10. # Displays status of a plugin
  11. $ wp plugin status theme-check
  12. Plugin theme-check details:
  13. Name: Theme Check
  14. Status: Active
  15. Version: 20160523.1
  16. Author: Otto42, pross
  17. 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

Toggles a plugin’s activation state.

  1. wp plugin toggle <plugin>... [--network]

If the plugin is active, then it will be deactivated. If the plugin is
inactive, then it will be activated.

OPTIONS

  1. <plugin>...
  2. One or more plugins to toggle.
  3. [--network]
  4. If set, the plugin will be toggled for the entire multisite network.

EXAMPLES

  1. # Akismet is currently activated
  2. $ wp plugin toggle akismet
  3. Plugin 'akismet' deactivated.
  4. Success: Toggled 1 of 1 plugins.
  5. # Akismet is currently deactivated
  6. $ wp plugin toggle akismet
  7. Plugin 'akismet' activated.
  8. Success: Toggled 1 of 1 plugins.

wp plugin uninstall

Uninstalls one or more plugins.

  1. wp plugin uninstall [<plugin>...] [--deactivate] [--skip-delete] [--all] [--exclude=<name>]

OPTIONS

  1. [<plugin>...]
  2. One or more plugins to uninstall.
  3. [--deactivate]
  4. Deactivate the plugin before uninstalling. Default behavior is to warn and skip if the plugin is active.
  5. [--skip-delete]
  6. If set, the plugin files will not be deleted. Only the uninstall procedure
  7. will be run.
  8. [--all]
  9. If set, all plugins will be uninstalled.
  10. [--exclude=<name>]
  11. Comma separated list of plugin slugs to be excluded from uninstall.

EXAMPLES

  1. $ wp plugin uninstall hello
  2. Uninstalled and deleted 'hello' plugin.
  3. Success: Uninstalled 1 of 1 plugins.
  4. # Uninstall all plugins excluding specified ones
  5. $ wp plugin uninstall --all --exclude=hello-dolly,jetpack
  6. Uninstalled and deleted 'akismet' plugin.
  7. Uninstalled and deleted 'tinymce-templates' plugin.
  8. Success: Uninstalled 2 of 2 plugins.

wp plugin update

Updates one or more plugins.

  1. wp plugin update [<plugin>...] [--all] [--exclude=<name>] [--minor] [--patch] [--format=<format>] [--version=<version>] [--dry-run] [--insecure]

OPTIONS

  1. [<plugin>...]
  2. One or more plugins to update.
  3. [--all]
  4. If set, all plugins that have updates will be updated.
  5. [--exclude=<name>]
  6. Comma separated list of plugin names that should be excluded from updating.
  7. [--minor]
  8. Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0)
  9. [--patch]
  10. Only perform updates for patch releases (e.g. from 1.3 to 1.3.3 instead of 1.4)
  11. [--format=<format>]
  12. Render output in a particular format.
  13. ---
  14. default: table
  15. options:
  16. - table
  17. - csv
  18. - json
  19. - summary
  20. ---
  21. [--version=<version>]
  22. If set, the plugin will be updated to the specified version.
  23. [--dry-run]
  24. Preview which plugins would be updated.
  25. [--insecure]
  26. Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.

EXAMPLES

  1. $ wp plugin update bbpress --version=dev
  2. Installing bbPress (Development Version)
  3. Downloading install package from https://downloads.wordpress.org/plugin/bbpress.zip...
  4. Unpacking the package...
  5. Installing the plugin...
  6. Removing the old version of the plugin...
  7. Plugin updated successfully.
  8. Success: Updated 1 of 2 plugins.
  9. $ wp plugin update --all
  10. Enabling Maintenance mode...
  11. Downloading update from https://downloads.wordpress.org/plugin/akismet.3.1.11.zip...
  12. Unpacking the update...
  13. Installing the latest version...
  14. Removing the old version of the plugin...
  15. Plugin updated successfully.
  16. Downloading update from https://downloads.wordpress.org/plugin/nginx-champuru.3.2.0.zip...
  17. Unpacking the update...
  18. Installing the latest version...
  19. Removing the old version of the plugin...
  20. Plugin updated successfully.
  21. Disabling Maintenance mode...
  22. +------------------------+-------------+-------------+---------+
  23. | name | old_version | new_version | status |
  24. +------------------------+-------------+-------------+---------+
  25. | akismet | 3.1.3 | 3.1.11 | Updated |
  26. | nginx-cache-controller | 3.1.1 | 3.2.0 | Updated |
  27. +------------------------+-------------+-------------+---------+
  28. Success: Updated 2 of 2 plugins.
  29. $ wp plugin update --all --exclude=akismet
  30. Enabling Maintenance mode...
  31. Downloading update from https://downloads.wordpress.org/plugin/nginx-champuru.3.2.0.zip...
  32. Unpacking the update...
  33. Installing the latest version...
  34. Removing the old version of the plugin...
  35. Plugin updated successfully.
  36. Disabling Maintenance mode...
  37. +------------------------+-------------+-------------+---------+
  38. | name | old_version | new_version | status |
  39. +------------------------+-------------+-------------+---------+
  40. | nginx-cache-controller | 3.1.1 | 3.2.0 | Updated |
  41. +------------------------+-------------+-------------+---------+

wp theme

Manages themes, including installs, activations, and updates.

  1. wp theme

See the WordPress Theme Handbook developer resource for more information on themes.

EXAMPLES

  1. # Install the latest version of a theme from wordpress.org and activate
  2. $ wp theme install twentysixteen --activate
  3. Installing Twenty Sixteen (1.2)
  4. Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
  5. Unpacking the package...
  6. Installing the theme...
  7. Theme installed successfully.
  8. Activating 'twentysixteen'...
  9. Success: Switched to 'Twenty Sixteen' theme.
  10. Success: Installed 1 of 1 themes.
  11. # Get details of an installed theme
  12. $ wp theme get twentysixteen --fields=name,title,version
  13. +---------+----------------+
  14. | Field | Value |
  15. +---------+----------------+
  16. | name | Twenty Sixteen |
  17. | title | Twenty Sixteen |
  18. | version | 1.2 |
  19. +---------+----------------+
  20. # Get status of theme
  21. $ wp theme status twentysixteen
  22. Theme twentysixteen details:
  23. Name: Twenty Sixteen
  24. Status: Active
  25. Version: 1.2
  26. Author: the WordPress team

wp theme activate

Activates a theme.

  1. wp theme activate <theme>

OPTIONS

  1. <theme>
  2. The theme to activate.

EXAMPLES

  1. $ wp theme activate twentysixteen
  2. Success: Switched to 'Twenty Sixteen' theme.

wp theme delete

Deletes one or more themes.

  1. wp theme delete [<theme>...] [--all] [--force]

Removes the theme or themes from the filesystem.

OPTIONS

  1. [<theme>...]
  2. One or more themes to delete.
  3. [--all]
  4. If set, all themes will be deleted except active theme.
  5. [--force]
  6. To delete active theme use this.

EXAMPLES

  1. $ wp theme delete twentytwelve
  2. Deleted 'twentytwelve' theme.
  3. Success: Deleted 1 of 1 themes.

wp theme disable

Disables a theme on a WordPress multisite install.

  1. wp theme disable <theme> [--network]

Removes ability for a theme to be activated from the dashboard of a site
on a WordPress multisite install.

OPTIONS

  1. <theme>
  2. The theme to disable.
  3. [--network]
  4. If set, the theme is disabled on the network level. Note that
  5. individual sites may still have this theme enabled if it was
  6. enabled for them independently.

EXAMPLES

  1. # Disable theme
  2. $ wp theme disable twentysixteen
  3. Success: Disabled the 'Twenty Sixteen' theme.
  4. # Disable theme in network level
  5. $ wp theme disable twentysixteen --network
  6. Success: Network disabled the 'Twenty Sixteen' theme.

wp theme enable

Enables a theme on a WordPress multisite install.

  1. wp theme enable <theme> [--network] [--activate]

Permits theme to be activated from the dashboard of a site on a WordPress
multisite install.

OPTIONS

  1. <theme>
  2. The theme to enable.
  3. [--network]
  4. If set, the theme is enabled for the entire network
  5. [--activate]
  6. If set, the theme is activated for the current site. Note that
  7. the "network" flag has no influence on this.

EXAMPLES

  1. # Enable theme
  2. $ wp theme enable twentysixteen
  3. Success: Enabled the 'Twenty Sixteen' theme.
  4. # Network enable theme
  5. $ wp theme enable twentysixteen --network
  6. Success: Network enabled the 'Twenty Sixteen' theme.
  7. # Network enable and activate theme for current site
  8. $ wp theme enable twentysixteen --activate
  9. Success: Enabled the 'Twenty Sixteen' theme.
  10. Success: Switched to 'Twenty Sixteen' theme.

wp theme get

Gets details about a theme.

  1. wp theme get <theme> [--field=<field>] [--fields=<fields>] [--format=<format>]

OPTIONS

  1. <theme>
  2. The theme to get.
  3. [--field=<field>]
  4. Instead of returning the whole theme, returns the value of a single field.
  5. [--fields=<fields>]
  6. Limit the output to specific fields. Defaults to all fields.
  7. [--format=<format>]
  8. Render output in a particular format.
  9. ---
  10. default: table
  11. options:
  12. - table
  13. - csv
  14. - json
  15. - yaml
  16. ---

EXAMPLES

  1. $ wp theme get twentysixteen --fields=name,title,version
  2. +---------+----------------+
  3. | Field | Value |
  4. +---------+----------------+
  5. | name | Twenty Sixteen |
  6. | title | Twenty Sixteen |
  7. | version | 1.2 |
  8. +---------+----------------+

wp theme install

Installs one or more themes.

  1. wp theme install <theme|zip|url>... [--version=<version>] [--force] [--ignore-requirements] [--activate] [--insecure]

OPTIONS

  1. <theme|zip|url>...
  2. 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.
  3. [--version=<version>]
  4. If set, get that particular version from wordpress.org, instead of the
  5. stable version.
  6. [--force]
  7. If set, the command will overwrite any installed version of the theme, without prompting
  8. for confirmation.
  9. [--ignore-requirements]
  10. If set, the command will install the theme while ignoring any WordPress or PHP version requirements
  11. specified by the theme authors.
  12. [--activate]
  13. If set, the theme will be activated immediately after install.
  14. [--insecure]
  15. Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.

EXAMPLES

  1. # Install the latest version from wordpress.org and activate
  2. $ wp theme install twentysixteen --activate
  3. Installing Twenty Sixteen (1.2)
  4. Downloading install package from http://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
  5. Unpacking the package...
  6. Installing the theme...
  7. Theme installed successfully.
  8. Activating 'twentysixteen'...
  9. Success: Switched to 'Twenty Sixteen' theme.
  10. Success: Installed 1 of 1 themes.
  11. # Install from a local zip file
  12. $ wp theme install ../my-theme.zip
  13. # Install from a remote zip file
  14. $ wp theme install http://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef

wp theme is-installed

Checks if a given theme is installed.

  1. wp theme is-installed <theme>

Returns exit code 0 when installed, 1 when uninstalled.

OPTIONS

  1. <theme>
  2. The theme to check.

EXAMPLES

  1. # Check whether theme is installed; exit status 0 if installed, otherwise 1
  2. $ wp theme is-installed hello
  3. $ echo $?
  4. 1

wp theme list

Gets a list of themes.

  1. wp theme list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--status=<status>] [--skip-update-check]

OPTIONS

  1. [--<field>=<value>]
  2. Filter results based on the value of a field.
  3. [--field=<field>]
  4. Prints the value of a single field for each theme.
  5. [--fields=<fields>]
  6. Limit the output to specific object fields.
  7. [--format=<format>]
  8. Render output in a particular format.
  9. ---
  10. default: table
  11. options:
  12. - table
  13. - csv
  14. - json
  15. - count
  16. - yaml
  17. ---
  18. [--status=<status>]
  19. Filter the output by theme status.
  20. ---
  21. options:
  22. - active
  23. - parent
  24. - inactive
  25. ---
  26. [--skip-update-check]
  27. If set, the theme update check will be skipped.

AVAILABLE FIELDS

These fields will be displayed by default for each theme:

  • name
  • status
  • update
  • version
  • update_version
  • auto_update

These fields are optionally available:

  • update_package
  • update_id
  • title
  • description

EXAMPLES

  1. # List inactive themes.
  2. $ wp theme list --status=inactive --format=csv
  3. name,status,update,version,update_version,auto_update
  4. twentyfourteen,inactive,none,3.8,,off
  5. twentysixteen,inactive,available,3.0,3.1,off

wp theme mod

Sets, gets, and removes theme mods.

  1. wp theme mod

EXAMPLES

  1. # Set the 'background_color' theme mod to '000000'.
  2. $ wp theme mod set background_color 000000
  3. Success: Theme mod background_color set to 000000.
  4. # Get single theme mod in JSON format.
  5. $ wp theme mod get background_color --format=json
  6. [{"key":"background_color","value":"dd3333"}]
  7. # Remove all theme mods.
  8. $ wp theme mod remove --all
  9. Success: Theme mods removed.

wp theme mod get

Gets one or more theme mods.

  1. wp theme mod get [<mod>...] [--field=<field>] [--all] [--format=<format>]

OPTIONS

  1. [<mod>...]
  2. One or more mods to get.
  3. [--field=<field>]
  4. Returns the value of a single field.
  5. [--all]
  6. List all theme mods
  7. [--format=<format>]
  8. Render output in a particular format.
  9. ---
  10. default: table
  11. options:
  12. - table
  13. - json
  14. - csv
  15. - yaml
  16. ---

EXAMPLES

  1. # Get all theme mods.
  2. $ wp theme mod get --all
  3. +------------------+---------+
  4. | key | value |
  5. +------------------+---------+
  6. | background_color | dd3333 |
  7. | link_color | #dd9933 |
  8. | main_text_color | #8224e3 |
  9. +------------------+---------+
  10. # Get single theme mod in JSON format.
  11. $ wp theme mod get background_color --format=json
  12. [{"key":"background_color","value":"dd3333"}]
  13. # Get value of a single theme mod.
  14. $ wp theme mod get background_color --field=value
  15. dd3333
  16. # Get multiple theme mods.
  17. $ wp theme mod get background_color header_textcolor
  18. +------------------+--------+
  19. | key | value |
  20. +------------------+--------+
  21. | background_color | dd3333 |
  22. | header_textcolor | |
  23. +------------------+--------+

wp theme mod set

Sets the value of a theme mod.

  1. wp theme mod set <mod> <value>

OPTIONS

  1. <mod>
  2. The name of the theme mod to set or update.
  3. <value>
  4. The new value.

EXAMPLES

  1. # Set theme mod
  2. $ wp theme mod set background_color 000000
  3. Success: Theme mod background_color set to 000000.

wp theme mod remove

Removes one or more theme mods.

  1. wp theme mod remove [<mod>...] [--all]

OPTIONS

  1. [<mod>...]
  2. One or more mods to remove.
  3. [--all]
  4. Remove all theme mods.

EXAMPLES

  1. # Remove all theme mods.
  2. $ wp theme mod remove --all
  3. Success: Theme mods removed.
  4. # Remove single theme mod.
  5. $ wp theme mod remove background_color
  6. Success: 1 mod removed.
  7. # Remove multiple theme mods.
  8. $ wp theme mod remove background_color header_textcolor
  9. Success: 2 mods removed.

wp theme path

Gets the path to a theme or to the theme directory.

  1. wp theme path [<theme>] [--dir]

OPTIONS

  1. [<theme>]
  2. The theme to get the path to. Path includes "style.css" file.
  3. If not set, will return the path to the themes directory.
  4. [--dir]
  5. If set, get the path to the closest parent directory, instead of the
  6. theme's "style.css" file.

EXAMPLES

  1. # Get theme path
  2. $ wp theme path
  3. /var/www/example.com/public_html/wp-content/themes
  4. # Change directory to theme path
  5. $ cd $(wp theme path)

Searches the WordPress.org theme directory.

  1. wp theme search <search> [--page=<page>] [--per-page=<per-page>] [--field=<field>] [--fields=<fields>] [--format=<format>]

Displays themes in the WordPress.org theme directory matching a given
search query.

OPTIONS

  1. <search>
  2. The string to search for.
  3. [--page=<page>]
  4. Optional page to display.
  5. ---
  6. default: 1
  7. ---
  8. [--per-page=<per-page>]
  9. Optional number of results to display. Defaults to 10.
  10. [--field=<field>]
  11. Prints the value of a single field for each theme.
  12. [--fields=<fields>]
  13. Ask for specific fields from the API. Defaults to name,slug,author,rating. Acceptable values:
  14. **name**: Theme Name
  15. **slug**: Theme Slug
  16. **version**: Current Version Number
  17. **author**: Theme Author
  18. **preview_url**: Theme Preview URL
  19. **screenshot_url**: Theme Screenshot URL
  20. **rating**: Theme Rating
  21. **num_ratings**: Number of Theme Ratings
  22. **homepage**: Theme Author's Homepage
  23. **description**: Theme Description
  24. **url**: Theme's URL on wordpress.org
  25. [--format=<format>]
  26. Render output in a particular format.
  27. ---
  28. default: table
  29. options:
  30. - table
  31. - csv
  32. - json
  33. - count
  34. - yaml
  35. ---

EXAMPLES

  1. $ wp theme search photo --per-page=6
  2. Success: Showing 6 of 203 themes.
  3. +----------------------+----------------------+--------+
  4. | name | slug | rating |
  5. +----------------------+----------------------+--------+
  6. | Photos | photos | 100 |
  7. | Infinite Photography | infinite-photography | 100 |
  8. | PhotoBook | photobook | 100 |
  9. | BG Photo Frame | bg-photo-frame | 0 |
  10. | fPhotography | fphotography | 0 |
  11. | Photo Perfect | photo-perfect | 98 |
  12. +----------------------+----------------------+--------+

wp theme status

Reveals the status of one or all themes.

  1. wp theme status [<theme>]

OPTIONS

  1. [<theme>]
  2. A particular theme to show the status for.

EXAMPLES

  1. $ wp theme status twentysixteen
  2. Theme twentysixteen details:
  3. Name: Twenty Sixteen
  4. Status: Inactive
  5. Version: 1.2
  6. Author: the WordPress team

wp theme update

Updates one or more themes.

  1. wp theme update [<theme>...] [--all] [--exclude=<theme-names>] [--minor] [--patch] [--format=<format>] [--version=<version>] [--dry-run] [--insecure]

OPTIONS

  1. [<theme>...]
  2. One or more themes to update.
  3. [--all]
  4. If set, all themes that have updates will be updated.
  5. [--exclude=<theme-names>]
  6. Comma separated list of theme names that should be excluded from updating.
  7. [--minor]
  8. Only perform updates for minor releases (e.g. from 1.3 to 1.4 instead of 2.0)
  9. [--patch]
  10. Only perform updates for patch releases (e.g. from 1.3 to 1.3.3 instead of 1.4)
  11. [--format=<format>]
  12. Render output in a particular format.
  13. ---
  14. default: table
  15. options:
  16. - table
  17. - csv
  18. - json
  19. - summary
  20. ---
  21. [--version=<version>]
  22. If set, the theme will be updated to the specified version.
  23. [--dry-run]
  24. Preview which themes would be updated.
  25. [--insecure]
  26. Retry downloads without certificate validation if TLS handshake fails. Note: This makes the request vulnerable to a MITM attack.

EXAMPLES

  1. # Update multiple themes
  2. $ wp theme update twentyfifteen twentysixteen
  3. Downloading update from https://downloads.wordpress.org/theme/twentyfifteen.1.5.zip...
  4. Unpacking the update...
  5. Installing the latest version...
  6. Removing the old version of the theme...
  7. Theme updated successfully.
  8. Downloading update from https://downloads.wordpress.org/theme/twentysixteen.1.2.zip...
  9. Unpacking the update...
  10. Installing the latest version...
  11. Removing the old version of the theme...
  12. Theme updated successfully.
  13. +---------------+-------------+-------------+---------+
  14. | name | old_version | new_version | status |
  15. +---------------+-------------+-------------+---------+
  16. | twentyfifteen | 1.4 | 1.5 | Updated |
  17. | twentysixteen | 1.1 | 1.2 | Updated |
  18. +---------------+-------------+-------------+---------+
  19. Success: Updated 2 of 2 themes.
  20. # Exclude themes updates when bulk updating the themes
  21. $ wp theme update --all --exclude=twentyfifteen
  22. Downloading update from https://downloads.wordpress.org/theme/astra.1.0.5.1.zip...
  23. Unpacking the update...
  24. Installing the latest version...
  25. Removing the old version of the theme...
  26. Theme updated successfully.
  27. Downloading update from https://downloads.wordpress.org/theme/twentyseventeen.1.2.zip...
  28. Unpacking the update...
  29. Installing the latest version...
  30. Removing the old version of the theme...
  31. Theme updated successfully.
  32. +-----------------+----------+---------+----------------+
  33. | name | status | version | update_version |
  34. +-----------------+----------+---------+----------------+
  35. | astra | inactive | 1.0.1 | 1.0.5.1 |
  36. | twentyseventeen | inactive | 1.1 | 1.2 |
  37. +-----------------+----------+---------+----------------+
  38. Success: Updated 2 of 2 themes.
  39. # Update all themes
  40. $ wp theme update --all

wp theme mod list

Gets a list of theme mods.

  1. wp theme mod list [--field=<field>] [--format=<format>]

OPTIONS

  1. [--field=<field>]
  2. Returns the value of a single field.
  3. [--format=<format>]
  4. Render output in a particular format.
  5. ---
  6. default: table
  7. options:
  8. - table
  9. - json
  10. - csv
  11. - yaml
  12. ---

EXAMPLES

  1. # Gets a list of theme mods.
  2. $ wp theme mod list
  3. +------------------+---------+
  4. | key | value |
  5. +------------------+---------+
  6. | background_color | dd3333 |
  7. | link_color | #dd9933 |
  8. | main_text_color | #8224e3 |
  9. +------------------+---------+

Installing

This package is included with WP-CLI itself, no additional installation necessary.

To install the latest version of this package over what’s included in WP-CLI, run:

  1. wp package install git@github.com:wp-cli/extension-command.git

Contributing

We appreciate you taking the initiative to contribute to this project.

Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

For a more thorough introduction, check out WP-CLI’s guide to contributing. This package follows those policy and guidelines.

Reporting a bug

Think you’ve found a bug? We’d love for you to help us get it fixed.

Before you create a new issue, you should search existing issues to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.

Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please create a new issue. Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, review our bug report documentation.

Creating a pull request

Want to contribute a new feature? Please first open a new issue to discuss whether the feature is a good fit for the project.

Once you’ve decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it’s a pleasant experience. See “Setting up“ for details specific to working on this package locally.

Support

GitHub issues aren’t for general support questions, but there are other venues you can try: https://wp-cli.org/#support

This README.md is generated dynamically from the project’s codebase using wp scaffold package-readme (doc). To suggest changes, please submit a pull request against the corresponding part of the codebase.