[00] Subset Opt-Out, For developers
WP-CLI commands
Every wp subset cookie-manager command in Subset Opt-Out and Opt-Out Pro, with its options, defaults and examples as wp help prints them.
Subset Opt-Out adds its commands under wp subset cookie-manager. The Pro commands appear once Subset Opt-Out Pro is active. Run wp help subset cookie-manager <command> on your site to see the same text there.
export
Prints the settings as JSON, the same document as Subset → Opt-Out → Export.
wp subset cookie-manager export [--file=<path>]
| Option | Default | What it does |
|---|---|---|
--file=<path> | None | Writes the JSON to this file instead of printing it. An existing file is replaced. |
wp subset cookie-manager export
wp subset cookie-manager export --file=cookie-manager.json
import
Imports settings from a JSON file made by export or the settings screen. The file is checked the way the settings screen checks it. If anything is wrong, every problem is listed, nothing is imported and the command exits with status 1. Settings the file leaves out stay as they are.
wp subset cookie-manager import <file> [--dry-run]
| Option | Default | What it does |
|---|---|---|
<file> | None | The JSON file, or - to read standard input. |
--dry-run | Off | Checks the file and lists what would change, but saves nothing. |
wp subset cookie-manager import cookie-manager.json --dry-run
wp subset cookie-manager export | wp subset cookie-manager import - --url=https://other.example
services
Lists the built-in services and custom rules, and whether each is on.
wp subset cookie-manager services [--detected] [--format=<format>]
| Option | Default | What it does |
|---|---|---|
--detected | Off | Adds a column for whether the last scan of the home page, run from the settings screen, found the service. Empty when there’s been no scan in the last week. |
--format=<format> | table | Output format: table, json, csv, yaml or count. |
wp subset cookie-manager services
wp subset cookie-manager services --format=json --detected
enable
Switches services on, so their scripts are held until a visitor allows them.
wp subset cookie-manager enable <service>...
| Option | Default | What it does |
|---|---|---|
<service>... | None | One or more service IDs, as the services command lists them. |
wp subset cookie-manager enable meta-pixel
disable
Switches services off, so their scripts load without waiting for consent. A custom rule can’t be switched off. Remove it on the settings screen or with rules remove.
wp subset cookie-manager disable <service>...
| Option | Default | What it does |
|---|---|---|
<service>... | None | One or more service IDs, as the services command lists them. |
wp subset cookie-manager disable meta-pixel
check
Fetches a page and reports which of its scripts would be held. It makes an HTTP request from your server to the URL you give, whichever site it’s on, and reads at most 2 MB of the response. Only http and https addresses are allowed. The page is matched against every known service, including ones switched off, and the held column says which would be held now. Nothing is changed.
wp subset cookie-manager check <url> [--insecure] [--format=<format>]
| Option | Default | What it does |
|---|---|---|
<url> | None | The page’s full address, such as https://example.com/. |
--insecure | Off | Doesn’t verify the site’s TLS certificate, for a local site with a self-signed one. |
--format=<format> | table | Output format: table, json, csv, yaml or count. |
wp subset cookie-manager check https://example.com/
rules
Lists, adds and removes custom blocking rules. These are the same custom_rules setting the rules editor on the settings screen saves, checked the same way. A change that would leave any rule invalid saves nothing.
wp subset cookie-manager rules list [--format=<format>]
wp subset cookie-manager rules add <type> <value> [--category=<category>]
wp subset cookie-manager rules remove <rule>...
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv, yaml or count | Lists the custom blocking rules. Rules added in code with the subset_cm_blocking_rules filter show the source filter, and can’t be removed here. |
add | <type>: handle, url or inline. <value>: a script handle (matched exactly), part of a script’s URL, or a keyword in inline code. --category: statistics or marketing (default) | Adds a rule, so scripts it matches are held until a visitor allows them. A value too short or common to be safe, a duplicate, or one that matches the plugin’s own scripts is refused. |
remove | <rule>...: one or more rules, by ID as list shows it, or by value | Removes custom blocking rules. |
wp subset cookie-manager rules add url stats.example.com --category=statistics
wp subset cookie-manager rules add inline acmeStats.init
wp subset cookie-manager rules list
wp subset cookie-manager rules remove custom-1a2b3c4d5e
wp subset cookie-manager rules remove stats.example.com
settings
Lists, reads and changes the plugin’s settings. Only known names are accepted, and values are cleaned the same way the settings screen cleans them. A setting pinned by a constant in wp-config.php can’t be changed here either.
wp subset cookie-manager settings list [--format=<format>]
wp subset cookie-manager settings get <name> [--format=<format>]
wp subset cookie-manager settings set <name> <value>
wp subset cookie-manager settings reset [--yes]
| Subcommand | Options | What it does |
|---|---|---|
list | --format: table (default), json, csv or yaml | Lists every setting, its value and its source: default, saved, filter or constant. |
get | --format: plain (default) or json | Prints one setting’s value. |
set | None | Changes one setting. Booleans take true/false, yes/no, on/off or 1/0. Lists take a JSON array or comma-separated values. |
reset | --yes skips the confirmation | Removes every saved setting, so each goes back to its default. A setting pinned by a constant keeps the constant’s value. |
The settings are regime, opt_out_covers_analytics, disabled_services, custom_rules, link_text, link_icon, link_auto_footer, privacy_policy_page_id, notice_bar_enabled, notice_text, colors, optout_log_enabled, optout_log_retention_days, geo_enabled, geo_states, geo_outside_us, optin_sensitive_site, optin_banner_text, optin_region_groups, optin_region_countries, consent_mode_enabled, consent_mode_ads_redaction and consent_mode_url_passthrough.
wp subset cookie-manager settings list
wp subset cookie-manager settings set notice_bar_enabled true
opt-in (Pro)
Shows and switches opt-in mode, the same settings as Opt-in mode on the Regions tab of Subset → Opt-Out. You can ask every visitor first (the sensitive-data setting), or only visitors in chosen regions.
wp subset cookie-manager opt-in get [--format=<format>]
wp subset cookie-manager opt-in on [--regions=<groups>] [--countries=<codes>]
wp subset cookie-manager opt-in off
| Subcommand | Options | What it does |
|---|---|---|
get | --format: table (default), json or yaml | Shows whether opt-in is on, and for whom. mode is everyone, regions or off. regime is what the site prints (optin while the browser decides for a region). |
on | --regions=<groups>: comma-separated groups, eea (EU/EEA), uk and ch (Switzerland). This turns the sensitive-data setting off, so only these regions are asked first. --countries=<codes>: comma-separated extra country codes | Turns opt-in on for every visitor, or with --regions or --countries only for visitors there. |
off | None | Turns opt-in off: the sensitive-data setting and every region. |
wp subset cookie-manager opt-in on
wp subset cookie-manager opt-in on --regions=eea,uk --countries=JE,GG
wp subset cookie-manager opt-in off
regions (Pro)
Shows and changes which US states see the “Do Not Sell or Share” link and the notice bar, as on the Regions tab of Subset → Opt-Out. See the Do Not Sell or Share link.
wp subset cookie-manager regions list [--selected] [--format=<format>]
wp subset cookie-manager regions get [--format=<format>]
wp subset cookie-manager regions set [<states>...] [--enabled=<on|off>] [--outside-us=<on|off>]
| Subcommand | Options | What it does |
|---|---|---|
list | --selected: only the selected states. --format: table (default), csv, json, yaml or count | Lists the states, whether each has a privacy law, and whether it’s selected. |
get | --format: table (default), json or yaml | Shows the state-aware settings. |
set | <states>...: state codes, separated by spaces or commas, replacing the selection. law selects the states with a privacy law (the default), and none clears it. --enabled=<on|off>: show the link and notice bar only to visitors in the selected states. --outside-us=<on|off>: also show them to visitors known to be outside the United States | Changes the selected states, and whether the link is limited to them. |
wp subset cookie-manager regions list
wp subset cookie-manager regions set CA CO VA --enabled=on
optout-log (Pro)
Lists, exports and purges the opt-out request log on Subset → Opt-Out → Opt-out log. The columns are the CSV export’s, and nothing more: no IP address is stored.
wp subset cookie-manager optout-log list [--since=<date>] [--format=<format>]
wp subset cookie-manager optout-log export [--file=<path>] [--format=<format>]
wp subset cookie-manager optout-log purge [--older-than=<days>] [--yes]
| Subcommand | Options | What it does |
|---|---|---|
list | --since=<date>: only records from this time on (UTC), such as 2026-01-01 or "-7 days". --format: table (default), csv, json, yaml or count | Lists the records, oldest first. |
export | --file=<path>: writes to this file instead of printing, replacing an existing file. --format: csv (default) or json | Exports every record, the same file as the Export as CSV button. |
purge | --older-than=<days>: deletes records more than this many days old. Defaults to the Keep records for setting, and 0 deletes every record made before now. --yes skips the confirmation | Deletes old records now, as the daily purge does. |
wp subset cookie-manager optout-log list --since="-30 days" --format=count
wp subset cookie-manager optout-log export --file=optouts.csv
wp subset cookie-manager optout-log purge --older-than=90 --yes