WP-CLI
The OOPSpam WordPress plugin ships with a set of WP-CLI commands that let you manage its settings from the command line. This is useful for automating configuration, rolling out the plugin across many sites, or managing settings on servers where you don’t have access to the WordPress dashboard.
All commands live under the oopspam namespace and require WP-CLI to be installed:
wp oopspam <command>The available commands are:
| Command | Purpose |
|---|---|
wp oopspam status | Show the plugin status and configuration overview |
wp oopspam get | Read one or all plugin settings |
wp oopspam set | Update a single setting |
wp oopspam set-many | Update multiple settings from JSON |
wp oopspam export | Export settings to a JSON file or stdout |
wp oopspam import | Import settings from a JSON file |
wp oopspam reset | Reset all settings to their defaults |
Status
Show an overview of the plugin configuration, including the plugin version, whether an API key is configured, and the rate limiting state:
wp oopspam statusExample output:
+----------------+----------------------+
| field | value |
+----------------+----------------------+
| plugin_version | 1.2.78 |
| configured | yes |
| api_key | 1234************5678 |
| api_key_source | dashboard |
| rate_limiting | yes |
| site_url | https://example.com |
| multisite | no |
+----------------+----------------------+The API key is masked for security, so it’s safe to include this output in logs or support requests.
Get settings
Read the current plugin settings. Without arguments, prints the whole settings collection as a table:
wp oopspam getPass a setting name to read a single value. Dotted paths are supported, so you can read a nested value inside an option:
wp oopspam get oopspamantispam_settings.oopspam_api_keyUse the --format flag to control the output. The available formats are table (default), json, and plain:
wp oopspam get --format=json
wp oopspam get oopspamantispam_settings.oopspam_api_key --format=plainSet a setting
Update a single setting. Dotted paths are supported, and JSON values are decoded automatically, so you can set structured data:
wp oopspam set oopspamantispam_settings.oopspam_api_key "abcdef123456"
wp oopspam set oopspamantispam_ratelimit_settings '{"oopspam_is_rt_enabled":"1","oopspamantispam_ratelimit_ip_limit":50}'
wp oopspam set oopspam_countryblocklist '["CN","RU"]'Set multiple settings
Update several settings at once from a JSON object. You can pass either a map of option keys to full values, or a map of dotted paths to values:
wp oopspam set-many '{"oopspamantispam_settings.oopspam_spam_message":"Blocked","oopspamantispam_settings.oopspam_api_key":"abc123"}'On a multisite network, add --all-sites to apply the changes to every site:
wp oopspam set-many '{"oopspam_countryblocklist":["CN"]}' --all-sitesExport settings
Export all plugin settings to a JSON file. The exported file can be restored on the same site, moved to another site, or imported through the plugin’s Tools tab in the WordPress dashboard:
wp oopspam export /tmp/oopspam-settings.jsonIf you omit the file path, the JSON is printed to stdout, so you can redirect it:
wp oopspam export > oopspam-settings.jsonImport settings
Import settings from a JSON file produced by wp oopspam export or by the plugin’s Tools tab:
wp oopspam import /tmp/oopspam-settings.jsonBy default, existing settings are preserved and imported values override them (a merge). Pass --replace to replace each imported option entirely:
wp oopspam import /tmp/oopspam-settings.json --replaceOn a multisite network, add --all-sites to import the settings into every site:
wp oopspam import /tmp/oopspam-settings.json --all-sitesReset settings
Reset every plugin setting back to its default state. A confirmation prompt is shown first, which you can skip with --yes:
wp oopspam reset
wp oopspam reset --yesOn a multisite network, add --all-sites to reset the settings on every site:
wp oopspam reset --yes --all-sitesMultisite networks
The commands that change settings accept an --all-sites flag: set-many, import, and reset. On a multisite network, this applies the command to every site in the network. On a single site, the flag is ignored and the command runs for the current site only, with a warning.