WordPress® Toolkit Command Line Interface

Valid for versions 92 through the latest version

Version:

92


Overview

This document lists all of the commands available via the WordPress® Toolkit command line interface.

Create a WordPress site backup

wp-toolkit --backup
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -operation list|backup|restore -filename FILENAME
    -format raw|json

Options

This command accepts the following options:

Option
Description
-instance-id The WordPress installation’s ID.
-domain-name The domain name.
-path The relative filepath from the domain’s document root directory. For example: /subdirectory
-operation The action to perform:
  • backup — Perform a WordPress site backup.
  • restore — Restore a WordPress site backup.
  • list — List available backup files.
-filename The backup file’s name.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --backup -instance-id 1 -operation backup

Clear a WordPress installation cache

wp-toolkit --clear-cache 
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -format raw|json

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --clear-cache -instance-id 1

Clear the WordPress Toolkit cache

wp-toolkit --clear-wpt-cache 

Display the WordPress Toolkit help documentation

wp-toolkit --help
    -command COMMAND_NAME

Options

This command accepts the following options:

Option Description
-command Display a WordPress Toolkit command’s help documentation.

Example

wp-toolkit --help -command wp-cli

Clone a WordPress site to a domain and/or subdirectory

wp-toolkit --clone
    -source-instance-id INSTANCE_ID
    -target-domain-name DOMAIN_NAME
    -target-path PATH
    -target-db-name DB_NAME
    -target-db-user-login DB_USER_LOGIN
    -force-overwrite yes|no
    -format raw|json
    -show-progress yes|no

Options

This command accepts the following options:

Option
Description
-source-instance-id Required The source WordPress site ID to clone.
-target-domain-name The target domain name to clone the WordPress site ID to.
-target-path The path inside the target domain’s document root for cloning the WordPress site. This option defaults to the domain root.
-target-db-name The target database name. If you do not use this option, the command automatically creates the database’s name.
-target-db-user-login The username of the target database user. To specify a password for the database user, use the TARGET_DB_USER_PASSWORD environment variable. If you do not use this option, the command automatically creates the username.
-force-overwrite Whether WordPress Toolkit will overwrite data on the target domain and path, ignoring any existing WordPress installations and other site data.
  • yes — Overwrite data.
  • no — Do not overwrite data.

This option defaults to no.

-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

-show-progress Whether to display the operation’s progress:
  • yes — Display the operation’s progress.
  • no — Perform the operation silently.

By default, the command displays the operation progress unless you’ve specified the json output format.

Example

wp-toolkit --clone -source-instance-id 1 -target-domain-id 2

Manage WordPress Toolkit configuration settings

wp-toolkit --config
    -operation list|get|set|rollback
    -option-name OPTION_NAME
    -option-value OPTION_VALUE
    -format raw|json

Options

This command accepts the following options:

Option
Description
-operation Required The action to perform:
  • list — Display all available configuration settings and their current values.
  • get — Display a configuration setting’s information. This option requires the -option-name option.
  • set — Set a new configuration setting value. This option requires the -option-name and -option-value options.
  • rollback — Restore a configuration setting to its default value. This option requires the -option-name option.
-option-name The configuration setting’s name. The setting’s name is case-sensitive and cannot be a read-only configuration setting.
-option-value The new configuration setting value.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --config -operation get -option-name logSecurityCheckErrors

Copy file and database table data from one WordPress site to another

wp-toolkit --copy-data
    -source-instance-id SOURCE_INSTANCE_ID
    -target-instance-id TARGET_INSTANCE_ID
    -data-to-copy all|files|db
    -files-replace-modified yes|no
    -files-remove-missing yes|no
    -db-tables-copy-mode default|all|new|selected
    -db-tables COMMA_SEPARATED_LIST_OF_TABLE_NAMES
    -exclude-db-tables COMMA_SEPARATED_LIST_OF_TABLE_NAMES
    -create-restore-point yes|no
    -show-progress yes|no

Options

This command accepts the following options:

Option
Description
-source-instance-id Required The source WordPress site’s installation ID.
-target-instance-id Required The target WordPress site’s installation ID.
-data-to-copy The data to copy:
  • all — Copy all files and database.
  • files — Copy files only.
  • db — Copy the database only.
-files-replace-modified Whether to replace the target WordPress site’s files with the source WordPress site’s files, even if the source site’s files are older:
  • yes — Replace the target site’s files.
  • no — Do not replace the target site’s files.

This option defaults to yes.

-files-remove-missing Whether to remove any files that exist on the target WordPress site but do not exist on the source site:
  • yes — Remove files.
  • no — Do not remove files.
-db-tables-copy-mode The database tables to copy:
  • default — Copy all tables except the postmeta, posts, usermeta, users data tables.
  • all — Copy all tables of the source WordPress site. You can exclude specific tables with the -exclude-db-tables option.
  • new — Copy tables that exist on the source WordPress site but do not exist on the target WordPress site.
  • selected — Select the exact tables to copy. This option requires the -db-tables option.
-db-tables A comma-separated list of database tables to copy.
-exclude-db-tables A comma-separated list of database tables to exclude from copying.
-create-restore-point Create a restore point you can use to revert any changes:
  • yes — Create a restore point.
  • no — Do not create a restore point.

This option defaults to yes.

-show-progress Whether to display the operation’s progress:
  • yes — Display the operation’s progress.
  • no — Perform the operation silently.

By default, the function displays the operation progress unless you’ve specified the json output format.

Example

wp-toolkit --copy-data -source-instance-id 1 -target-instance-id 2 -data-to-copy files

Detach a WordPress site from WordPress Toolkit

wp-toolkit --detach 
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
Note:

This command does not uninstall the cPanel account’s WordPress site.

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory

Example

wp-toolkit --detach -instance-id 1

Display information about a WordPress installation

wp-toolkit --info
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -format raw|json

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --info -instance-id 1

Install a new WordPress site on a domain

wp-toolkit --install
    -domain-name DOMAIN_NAME
    -username USERNAME
    -admin-email EMAIL
    -protocol PROTOCOL
    -path PATH
    -version VERSION
    -language LANGUAGE
    -db-name DB_NAME
    -db-user DB_USER
    -table-prefix TABLE_PREFIX
    -site-title SITE_TITLE
    -auto-updates true|false|minor
    -plugins-auto-updates true|false
    -themes-auto-updates true|false
    -format raw|json
    -show-progress yes|no

Options

This command accepts the following options:

Option
Description
-domain-name Required The domain name.
-username The WordPress site administrator’s username. To set its password, use the ADMIN_PASSWORD environment variable. If you do not specify this value, the system generates an admin_ account with a randomized suffix value. For example: admin_jzsfbt4l
-admin-email The WordPress site administrator’s email address. If you do not specify this value, the system creates the admin email account. For example: admin@example.com
-protocol The WordPress site’s protocol:
  • http — The HTTP protocol.
  • https — The HTTPS protocol.

This option defaults to https.

-path A relative filepath from the domain’s document root directory. For example: /subdirectory This option defaults to the cPanel account’s home directory.
-version The WordPress version number. For a list of available versions, use the --versions command. This option defaults to the most recent version of WordPress.
-language The WordPress site’s locale. For a list of available locales, use the --languages command. This option defaults to en_US.
-db-name The database’s name. If you do not specify this value, the system generates a database name using the cPanel account’s username. For example: username_wp_f0ehk
-db-user The database user’s username. To specify a password for the database user, use the DB_PASSWORD environment variable. If you do not specify this value, the system generates a username using the cPanel account’s username. For example: username_wp_vfcf4
-table-prefix The database table’s prefix. If you do not specify this value, the system generates a prefix.
-site-title The WordPress site’s title, surrounded by quotes. If you do not specify this value, the system generates a random site title.
-auto-updates Whether to enable automatic security updates for the new Wordpress site:
  • true — Enable all (major and minor) automatic security updates.
  • false — Do not enable automatic security updates.
  • minor — Only enable minor security updates.

This option defaults to true.

-plugins-auto-updates Whether to enable automatic updates for Wordpress plugins:
  • true — Enable automatic updates.
  • false — Do not enable automatic updates.

This option defaults to false.

-themes-auto-updates Whether to enable automatic updates for Wordpress themes:
  • true — Enable automatic updates.
  • false — Do not enable automatic updates.

This option defaults to false.

-show-progress Whether to display the operation’s progress:
  • yes — Display the operation progress.
  • no — Perform the operation silently.

By default, the function displays the operation progress unless you’ve specified the json output format.

-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --install -domain-name example.com -username WPadmin -site-title "My WordPress Site"

Display the available locales for a version of WordPress

wp-toolkit --languages
    -version VERSION
    -format raw|json

Options

This command accepts the following options:

Option Description
-version Required The WordPress version number.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --languages -version 5.7.1

Display information for all WordPress installations

wp-toolkit --list
    -domain-name DOMAIN_NAME
    -plugins
    -themes
    -format raw|json

Options

This command accepts the following options:

Option Description
-domain-name The domain name.
-plugins Also display each WordPress installation’s number of installed plugins.
-themes Also display each WordPress installation’s number of installed themes.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --list -plugins -themes

Manage your available WordPress plugins

wp-toolkit --plugins
    -operation list-custom|add|remove
    -id ID
    -version VERSION
    -source-url URL
    -format raw|json

Options

This command accepts the following options:

Option
Description
-operation Required The action to perform:
  • add — Add a new WordPress plugin. This option requires the -source-url and -path options.
  • remove — Remove an installed WordPress plugin. This option requires the -id and -version options.
  • list-custom — List all custom WordPress plugins.
-id The WordPress plugin’s ID.
-version The WordPress version number.
-source-url The plugin’s URL.
-path The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --plugins -operation list-custom

Add a WordPress installation to the WordPress Toolkit

wp-toolkit --register
    -domain-name DOMAIN_NAME -path PATH
    -format raw|json

Options

This command accepts the following options:

Option
Description
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --register -main-domain-id 1 -path subdirectory

Manage WordPress plugin and theme sets

wp-toolkit --sets
    -operation list|info|add|remove|rename|add-plugin|add-theme|remove-plugin|remove-theme|install|activate-plugin|deactivate-plugin|activate-theme|deactivate-theme
    -instance-id INSTANCE_ID
    -plugin-id PLUGIN_ID
    -plugin-slug PLUGIN_SLUG
    -set-id SET_ID
    -name NAME
    -theme-id THEME_ID
    -theme-slug THEME_SLUG
    -format raw|json

Options

This command accepts the following options:

Option
Description
-operation Required The action to perform:
  • list — List all available WordPress sets.
  • info — Display a WordPress set’s information. This option requires the set-id option.
  • add — Add a WordPress set. This option requires the -name option.
  • remove — Remove a WordPress set. This option requires the -set-id option.
  • rename — Rename a WordPress set. This option requires the -name option.
  • add-plugin — Add a WordPress plugin to a set. This option requires the -add-plugin and -remove-plugin options.
  • add-theme — Add a WordPress theme to a set. This option requires the -set-id option.
  • remove-plugin — Remove a WordPress plugin from a set. This option requires the -set-id option.
  • remove-theme — Remove a WordPress theme from a WordPress installation. This option requires the set-id and instance-id options.
  • install — Install a set on a WordPress installation. This option requires the set-id and instance-id options.
  • activate-plugin — Activate a WordPress set plugin. This option requires the set-id option and the plugin-id or plugin-slug options.
  • deactivate-plugin — Deactivate a WordPress set plugin. This option requires the set-id option and the plugin-id or plugin-slug options.
  • activate-theme — Activate a WordPress set theme. This option requires the set-id option and theme-id or theme-slug options.
  • deactivate-theme — Deactivate a WordPress set theme. This option requires the set-id option and the theme-id or theme-slug options.
-instance-id The WordPress installation’s ID.
-plugin-id The WordPress plugin’s ID.
-plugin-slug The WordPress plugin’s slug name.
-set-id The WordPress set’s ID.
-name The WordPress set’s name.
-theme-id The WordPress theme’s ID.
-theme-slug The WordPress theme’s slug name.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --sets -operation list

Manage WordPress Toolkit Smart Updates for a WordPress site

wp-toolkit --smart-update
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -operation status|enable|disable
    -format raw|json

Options

This command accepts the following options:

Option
Description
-instance-id The WordPress installation’s ID.
-domain-name The domain name.
-path The relative filepath from the domain’s document root directory. For example: /subdirectory
-operation Required The action to perform:
  • enable — Enable Smart Updates.
  • disable — Disable Smart Updates.
  • status — Display a WordPress installation’s Smart Update status. This option requires the -instance-id option.
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --smart-update -instance-id 1

Manage your available WordPress themes

wp-toolkit --themes
    -operation list-custom|add|remove
    -id ID
    -version VERSION
    -source-url URL
    -path PATH
    -format raw|json

Options

This command accepts the following options:

Option
Description
-operation Required The action to perform:
  • add — Add a WordPress theme. This option requires the -source-url and -path options.
  • remove — Remove a WordPress theme. This option requires the -id and -version options.
  • list-custom — List all installed WordPress themes.
-id The theme’s ID.
-version The WordPress version number.
-source-url The theme’s source URL.
-path The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --themes -operation remove -id 1 -version 2.0

Update a WordPress site URL

wp-toolkit --update-site-url
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -format raw|json

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --update-site-url -instance-id 1

List all available WordPress versions for WordPress Toolkit

wp-toolkit --versions
    -format raw|json

Options

This command accepts the following options:

Option Description
-format Output the data in a specific format:
  • json — JSON format.
  • raw — Raw output format.

This option defaults to raw data output.

Example

wp-toolkit --versions -format json

Execute a wp-cli command to the given WordPress installation

wp-toolkit --wp-cli
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    -- WP-CLI_COMMAND SUBCOMMAND
Note:

For a list of available commands and their subcommands, read WordPress’ wp-cli documentation.

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory

Example

wp-toolkit --wp-cli -instance-id 1 -- plugin activate akismet

Update the wp-config.php file settings

wp-toolkit --wp-config
    -instance-id INSTANCE_ID|-domain-name DOMAIN_NAME -path PATH
    --
    -db-charset DB_CHARSET
    -db-name DB_NAME
    -db-user DB_USER
    -db-password DB_PASSWORD
    -db-host DB_HOST
    -domain-current-site DOMAIN_CURRENT_SITE
    -path-current-site PATH_CURRENT_SITE
    -multisite MULTISITE
    -subdomain-install SUBDOMAIN_INSTALL
    -wp-auto-update-core WP_AUTO_UPDATE_CORE
    -wpcachehome WPCACHEHOME
    -wp-debug WP_DEBUG
    -wp-debug-log WP_DEBUG_LOG
    -wp-debug-display WP_DEBUG_DISPLAY
    -script-debug SCRIPT_DEBUG
    -savequeries SAVEQUERIES
    -wp-home WP_HOME
    -wp-siteurl WP_SITEURL
    -concatenate-scripts CONCATENATE_SCRIPTS
    -disallow-file-edit DISALLOW_FILE_EDIT
    -wp-cache-key-salt WP_CACHE_KEY_SALT
    -disable-wp-cron DISABLE_WP_CRON
Note:
  • You can pass all wp-config.php file settings through environment variables. To do this, you must specify an empty parameter value.
  • For information about the wp-config.php file and its settings, read WordPress’ Editing wp-config.php documentation.

Options

This command accepts the following options:

Option
Description
-instance-id Required The WordPress installation’s ID.
-domain-name Required The domain name.
-path Required The relative filepath from the domain’s document root directory. For example: /subdirectory

Example

wp-toolkit --wp-config instance-id 1 -- -db-charset utf8

Install a WordPress Toolkit license

wp-toolkit --apply-license

Update the operation system type and version

wp-toolkit --update-server-info 
Note:

This command may be required after converting your system from CentOS to CloudLinux.