wp theme

Manages themes, including installs, activations, and updates.

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

Commands Description
wp theme status Reveals the status of one or all themes.
wp theme search Searches the WordPress.org theme directory.
wp theme activate Activates a theme.
wp theme enable Enables a theme on a WordPress multisite install.
wp theme disable Disables a theme on a WordPress multisite install.
wp theme path Gets the path to a theme or to the theme directory.
wp theme install Installs one or more themes.
wp theme get Gets details about a theme.
wp theme update Updates one or more themes.
wp theme is-installed Checks if a given theme is installed.
wp theme is-active Checks if a given theme is active.
wp theme delete Deletes one or more themes.
wp theme list Gets a list of themes.
wp theme mod get Gets one or more theme mods.
wp theme mod list Gets a list of theme mods.
wp theme mod remove Removes one or more theme mods.
wp theme mod set Sets the value of a theme mod.

Examples

# 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 https://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.

# 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

Source code of the commands


wp theme status

Reveals the status of one or all themes.

Usage

wp theme status [{theme}]

You can specify global options and the following:

[{theme}]
A particular theme to show the status for.

Examples

$ wp theme status twentysixteen
Theme twentysixteen details:
		Name: Twenty Sixteen
		Status: Inactive
		Version: 1.2
		Author: the WordPress team

Searches the WordPress.org theme directory.

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

Usage

wp theme search {search} [--per-page={per-page}] [--field={field}] [--fields={fields}] [--format={format}]

You can specify global options and the following:

{search}
The string to search for.
[--per-page={per-page}]
Optional number of results to display. Defaults to 10.
[--field={field}]
Prints the value of a single field for each theme.
[--fields={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={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • csv
  • json
  • count
  • yaml

Examples

$ 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 activate

Activates a theme.

Usage

wp theme activate {theme}

You can specify global options and the following:

{theme}
The theme to activate.

Examples

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

wp theme enable

Enables a theme on a WordPress multisite install.

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

Usage

wp theme enable {theme} [--network] [--activate]

You can specify global options and the following:

{theme}
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.

Examples

# 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 disable

Disables a theme on a WordPress multisite install.

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

Usage

wp theme disable {theme} [--network]

You can specify global options and the following:

{theme}
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.

Examples

# 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.

wp theme path

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

Usage

wp theme path [{theme}] [--dir]

You can specify global options and the following:

[{theme}]
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.

Examples

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

wp theme install

Installs one or more themes.

Usage

wp theme install {theme|zip|url}... [--version={version}] [--force] [--activate]

You can specify global options and the following:

{theme|zip|url}...
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={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.

Examples

# 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.
# 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 get

Gets details about a theme.

Usage

wp theme get {theme} [--field={field}] [--fields={fields}] [--format={format}]

You can specify global options and the following:

{theme}
The theme to get.
[--field={field}]
Instead of returning the whole theme, returns the value of a single field.
[--fields={fields}]
Limit the output to specific fields. Defaults to all fields.
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • csv
  • json
  • yaml

Examples

$ wp theme get twentysixteen --fields=name,title,version
+---------+----------------+
| Field   | Value          |
+---------+----------------+
| name    | Twenty Sixteen |
| title   | Twenty Sixteen |
| version | 1.2            |
+---------+----------------+

wp theme update

Updates one or more themes.

Usage

wp theme update [{theme}...] [--all] [--exclude={theme-names}] [--format={format}] [--version={version}] [--dry-run]

You can specify global options and the following:

[{theme}...]
One or more themes to update.
[--all]
If set, all themes that have updates will be updated.
[--exclude={theme-names}]
Comma separated list of theme names that should be excluded from updating.
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • csv
  • json
  • summary
[--version={version}]
If set, the theme will be updated to the specified version.
[--dry-run]
Preview which themes would be updated.

Examples

# 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 is-installed

Checks if a given theme is installed.

Returns exit code 0 when installed, 1 when uninstalled.

Usage

wp theme is-installed {theme}

You can specify global options and the following:

{theme}
The theme to check.

Examples

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

wp theme is-active

Checks if a given theme is active.

Returns exit code 0 when active, 1 when not active.

Usage

wp theme is-active {theme}

You can specify global options and the following:

{theme}
The plugin to check.

Examples

# Check whether theme is Active; exit status 0 if active, otherwise 1
$ wp theme is-active twentyfifteen
$ echo $?
1

wp theme delete

Deletes one or more themes.

Removes the theme or themes from the filesystem.

Usage

wp theme delete {theme}...

You can specify global options and the following:

{theme}...
One or more themes to delete.

Examples

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

wp theme list

Gets a list of themes.

Usage

wp theme list [--{field}={value}] [--field={field}] [--fields={fields}] [--format={format}]

You can specify global options and the following:

[--{field}={value}]
Filter results based on the value of a field.
[--field={field}]
Prints the value of a single field for each theme.
[--fields={fields}]
Limit the output to specific object fields.
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • csv
  • json
  • count
  • yaml

Available fields

These fields will be displayed by default for each theme:

  • name
  • status
  • update
  • version

These fields are optionally available:

  • update_version
  • update_package
  • update_id
  • title
  • description

Examples

# List themes
$ wp theme list --status=inactive --format=csv
name,status,update,version
twentyfourteen,inactive,none,1.7
twentysixteen,inactive,available,1.1

wp theme mod get

Gets one or more theme mods.

Usage

wp theme mod get [{mod}...] [--field={field}] [--all] [--format={format}]

You can specify global options and the following:

[{mod}...]
One or more mods to get.
[--field={field}]
Returns the value of a single field.
[--all]
List all theme mods
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • json
  • csv
  • yaml

Examples

# 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 |        |
+------------------+--------+

wp theme mod list

Gets a list of theme mods.

Usage

wp theme mod list [--field={field}] [--format={format}]

You can specify global options and the following:

[--field={field}]
Returns the value of a single field.
[--format={format}]

Render output in a particular format.
Default: table
Can be:

  • table
  • json
  • csv
  • yaml

Examples

# Gets a list of theme mods.
$ wp theme mod list
+------------------+---------+
| key              | value   |
+------------------+---------+
| background_color | dd3333  |
| link_color       | #dd9933 |
| main_text_color  | #8224e3 |
+------------------+---------+

wp theme mod remove

Removes one or more theme mods.

Usage

wp theme mod remove [{mod}...] [--all]

You can specify global options and the following:

[{mod}...]
One or more mods to remove.
[--all]
Remove all theme mods.

Examples

# 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 mod set

Sets the value of a theme mod.

Usage

wp theme mod set {mod} {value}

You can specify global options and the following:

{mod}
The name of the theme mod to set or update.
{value}
The new value.

Examples

# Set theme mod
$ wp theme mod set background_color 000000
Success: Theme mod background_color set to 000000