[00] WP-CLI, User guide
Getting started
Install the Subset plugins from WP-CLI, activate a Pro licence without the key reaching your shell history, and find each plugin's commands under wp subset.
Every Subset plugin adds its WP-CLI commands under one group, wp subset. This page covers installing the plugins from a shell, activating a licence and finding the commands each plugin adds. You need WP-CLI (opens in a new tab) on the server, and a shell in the WordPress folder or a --path pointing at it.
See what’s there
The subset group appears once any Subset plugin is active. To list the plugins that have commands on this site, run:
wp help subset
Each plugin has its own subgroup, such as wp subset redirector. Run wp help subset <plugin> for its commands, and wp help subset <plugin> <command> for every option and an example.
Install the free plugins
Install a free plugin from its download link:
wp plugin install https://subsetwp.com/download/redirects --activate
The download names are sizes, opt-out, fill, redirects, clone, sync and seo. To get their updates on the Updates screen and from wp plugin update, install Subset Installer the same way:
wp plugin install https://subsetwp.com/download/installer --activate
See Subset Installer for what it does once it’s installed.
Install a Pro add-on
Download the add-on’s zip from Downloads in your account, copy it to the server and install it. Install and activate its free plugin first.
wp plugin install /path/to/the-add-on.zip --activate
On a multisite network, use --activate-network instead of --activate. Updates then come through WordPress’s own updater once the licence is active, so wp plugin update and auto-updates both work.
Activate a licence
Each Pro add-on adds a wp subset license <product> command. The product names match the download names above. Set the key in SUBSET_LICENSE_KEY so it stays out of your shell history and the process list:
SUBSET_LICENSE_KEY=subset_… wp subset license redirector activate
wp subset license redirector status
You can also pass the key as an argument. With a bundle, activate the same key once for each add-on. The site still uses one slot. See Activating a licence for what each status means, and Moving a licence before you take a site down.
Multisite
Pick the site a command runs against with --url:
wp subset redirector redirect list --url=shop.example.com
A licence covers the whole network, so activate it once rather than on each subsite. See Multisite networks.
In scripts
- Commands that change several things take
--dry-run, which prints what would change and writes nothing. - Commands that list things take
--format.jsonis the one to parse. - A command that fails exits with a non-zero status, so
set -estops the script. - Some commands ask before they delete or replace data. Add
--yesto skip the prompt. Subset Sync’s commands also need--confirm-production=<domain>before they replace a production database.
The command reference lists every command, free and Pro.