WP-CLI commands
Every WP-CLI command in BetterShield with an example: audit, findings, hardening, activity, recovery, lockdown, lockouts, the blocklist, files and settings.
BetterShield adds fifteen wp bettershield commands to WP-CLI. They use the same code as the dashboard, and changes are logged as coming through WP-CLI.
Note: A command that changes the site needs
--user=<login>, naming an account that can manage BetterShield; the change is recorded against it. Reading needs no user, andrecovernever asks for one.
The fifteen commands:
audit: the score, grade and open findings.findings: findings from the last audit.harden: list, preview, apply or undo a hardening fix.activity: the activity log.agents: every ability call on the site.verify_log: the activity log against its daily seals.recover: safe mode, from the terminal.lockdown: turn the site lockdown on or off.lockouts: list or release sign-in and form lockouts.blocklist: list, add or remove Never allowed to sign in entries.integrity: core and plugin files against the published copies.alerts: recipients, mute and host-managed routine alerts.settings: export or import BetterShield’s settings.vulnerabilities: the optional feed’s state, refresh and advisory results.diagnostics: a block for reporting a problem.
Audit and findings
wp bettershield audit
Runs the read-only audit and prints the score, grade and open findings by severity.
| Option | What it does | Default |
|---|---|---|
--format=<format> | summary or json. | summary |
--fail-under=<score> | Exit non-zero when the score is below this whole number, 0 to 100. | None |
--fail-on=<severity> | Exit non-zero when an open finding is at this severity or worse: critical, high, medium or low. | None |
wp bettershield audit --fail-under=80 --fail-on=high
wp bettershield findings
Lists findings from the last audit, with the ID of the fix where there is one.
| Option | What it does | Default |
|---|---|---|
--status=<status> | open, snoozed, suppressed, fixed or all. | open |
--format=<format> | table, json, csv or count. | table |
wp bettershield findings --status=snoozed
Hardening
wp bettershield harden
Lists the hardening fixes, or previews, applies or undoes one.
| Option | What it does | Default |
|---|---|---|
[<item>] | The fix’s ID. Leave it out to list every fix with its ID and state. | List |
--dry-run | Describe what applying would do, changing nothing. Not with --undo. | None |
--undo | Revert the fix. | None |
--force | Apply a sign-in fix even though the recovery check failed. Recorded in the activity log. | None |
--<field>=<value> | An option the fix takes, such as --slug=<address> for login_url. A list takes commas, such as - for admin_area_access. | None |
--format=<format> | For the list: table, json or csv. | table |
wp bettershield harden login_url --slug=side-door --user=admin
wp bettershield harden xmlrpc --undo --user=admin
Activity
wp bettershield activity
Shows the activity log, newest first.
| Option | What it does | Default |
|---|---|---|
--limit=<number> | How many entries, at most 500. | 40 |
--area=<area> | access, exposure, server, configuration, extensions or plugin. | All |
--search=<text> | Match who did it, what it was done to, or the event name. | None |
--actor=<token> | user:<id>, type:system or type:anonymous. | None |
--from=<date>, --to=<date> | Day range as YYYY-MM-DD, in the site’s time zone. | None |
--sites=<ids> | Multisite only: comma-separated site IDs, or all. | This site |
--format=<format> | table, json or csv. CSV exports every matching row. | table |
wp bettershield activity --from=2026-08-01 --to=2026-08-15 --format=csv > august.csv
wp bettershield agents
Shows every ability call on the site, from any plugin, newest first. Needs WordPress 7.1.
| Option | What it does | Default |
|---|---|---|
--limit=<number> | How many entries, at most 200. Not used for CSV. | 40 |
--outcome=<outcome> | completed, permission_denied, input_invalid, input_not_normalizable, output_invalid, short_circuited, failed or unknown. | All |
--ability=<name> | One ability, by exact name. | None |
--namespace=<prefix> | The ability name’s namespace prefix. | None |
--entry-path=<path> | How the call came in: rest, wp-cli, php, or mcp for an assistant. | None |
--format=<format> | table, json or csv (every matching row). | table |
wp bettershield agents --outcome=permission_denied
wp bettershield verify_log
Checks the activity log against its daily seals and exits non-zero if a sealed day was altered, removed or could not be read. Seals are written once a day, for finished days.
wp bettershield verify_log
Recovery
wp bettershield recover
Turns on safe mode: BetterShield’s protections pause (rules it wrote to .htaccess and index files stay in place) and the standard sign-in page answers again. No setting is lost.
| Option | What it does | Default |
|---|---|---|
--hours=<hours> | How long, 1 to 24. | 1 |
--end | End safe mode now and re-arm the protections it paused. | None |
--network | With --end, end the network-wide pause the network’s recovery link started, on every site. | None |
--new-link | Also issue a fresh recovery link and print it once. The previous link stops working. | None |
wp bettershield recover --hours=4 --new-link
wp bettershield lockdown
Shows, turns on or lifts the site lockdown. status needs no user; on and off need --user=<login>. From the terminal there is no browser session to keep, so on signs out every dashboard session, your own included. The recovery link and safe mode still outrank it.
| Option | What it does | Default |
|---|---|---|
[<action>] | status, on or off. | status |
wp bettershield lockdown on --user=admin
wp bettershield lockdown off --user=admin
Sign-in lockouts and the blocklist
wp bettershield lockouts
Lists lockouts on the sign-in form and the public forms, or releases them as Protection › Login & Access does. Releasing needs --user=<login> and is recorded in the activity log.
| Option | What it does | Default |
|---|---|---|
[<action>] | list or release. | list |
[<id>] | For release, the lockout’s ID, as the list shows it. | None |
--all | For release, every lockout running now, on --surface when it is given. | None |
--surface=<surface> | One form only: signin, comment, reset or register. | All forms |
--active | For list, only the lockouts running now. | None |
--limit=<number> | For list, how many to show. Running lockouts come first and are always shown. | 50 |
--format=<format> | table, json or csv. | table |
wp bettershield lockouts list --active
wp bettershield lockouts release --all --surface=signin --user=admin
wp bettershield blocklist
Lists Never allowed to sign in, or adds or removes an entry, with the same checks as Protection › Login & Access. An entry can name a network, part of a user agent, a username or a combination, and all of them have to match. Adding or removing needs --user=<login>, is recorded in the activity log, and can be reversed under Settings history on Settings › General.
| Option | What it does | Default |
|---|---|---|
[<action>] | list, add or remove. | list |
--range=<range> | An address or CIDR range, such as 203.0.113.0/24. | None |
--ua=<pattern> | Part of a user agent, at least four characters. | None |
--username=<login> | A username nobody may sign in as. | None |
--note=<note> | For add, why the entry is there. | None |
--format=<format> | For the list: table, json or csv. | table |
wp bettershield blocklist add --range=203.0.113.0/24 --note="Scanner" --user=admin
wp bettershield blocklist remove --range=203.0.113.0/24 --user=admin
Files
wp bettershield integrity
Compares core, directory-plugin and supported WPDeveloper paid-plugin files against published checksums. The first argument is the action.
| Action | What it does | Needs a user |
|---|---|---|
status (default) | When the check last ran, and the files that differ. | No |
scan | Runs the check now. | No |
restore --id=<change> | Puts the published copy back. The current file goes to quarantine, and an undo token is printed. | Yes |
suppress --id=<change> | Marks a change expected, with an undo token. | Yes |
unsuppress --id=<change> | Reports a marked change again. | Yes |
undo --token=<undo> | Reverses a restore or a marking. | Yes |
recheck --slug=<folder> | Compares a plugin’s open changes against its published version again. | Yes |
record-update --slug=<folder> --version=<version> | Records a known update deployed outside the WordPress updater; --type=theme for a theme. Existing open findings stay open. | Yes |
expect-file --file=<relative-path> | Records a reviewed host-written file as the expected state and prints an undo token. | Yes |
expect --slug=<folder> --version=<version> | Shows a plugin’s or theme’s group of changes (--type=theme for a theme). Add --yes to mark them expected together. | With --yes |
Other options: --format=table or json; --fail-on-changes exits non-zero when any file differs; --strict with it also fails when something could not be checked.
wp bettershield integrity restore --id=12 --user=admin
Email alerts
wp bettershield alerts
Manage the alert recipient list, mute or unmute security email, or let a host take routine alerts. Listing needs no user; changes need --user=<login>.
wp bettershield alerts recipients list --format=json
wp bettershield alerts recipients add security@example.com --user=admin
wp bettershield alerts recipients remove security@example.com --user=admin
wp bettershield alerts recipients reset --user=admin
wp bettershield alerts mute --user=admin
wp bettershield alerts unmute --user=admin
wp bettershield alerts host-managed on --user=admin
wp bettershield alerts host-managed off --user=admin
recipients reset restores the site administration email as the fallback. Adding a recipient or unmuting does not enable the instant-alert or weekly-summary switch. recipients list accepts table, json or csv and shows each address’s choices. Host-managed mode holds routine events for the weekly summary, while a new administrator, promotion to administrator, the trap password or a changed code file can still email immediately when instant alerts are enabled. See Host-managed alerts and Record host file changes.
Settings
wp bettershield settings
Exports BetterShield’s settings as JSON, or imports a settings document. An import only shows its plan until you add --apply.
| Option | What it does | Default |
|---|---|---|
<action> | export or import. | None |
[<file>] or --file=<path> | The document to write or read. With neither, export prints to the terminal. | None |
--apply | For import, make the changes. | Plan only |
--force | For an import that changes how people sign in, go ahead although the recovery check did not pass. Recorded in the activity log. | None |
wp bettershield settings export posture.json
wp bettershield settings import posture.json --apply --user=admin
Other commands
wp bettershield vulnerabilities
Shows the optional vulnerability feed’s state. check requests a refresh after consent. Read the last successful refresh and any stale or unavailable warning; an empty list alone does not prove the current inventory was checked.
| Option | What it does | Default |
|---|---|---|
[<action>] | status or check. | status |
--format=<format> | table or json. | table |
--fail-on=<severity> | Exit non-zero when an installed component is named by an advisory at this severity or worse. | None |
--strict | With --fail-on, also exit non-zero when nothing could be checked. | None |
wp bettershield vulnerabilities
wp bettershield diagnostics
Prints a block for reporting a problem: how BetterShield is set up, with nothing that identifies the site or anyone on it.
wp bettershield diagnostics
With Ultra
BetterShield Ultra adds wp bettershield-ultra policy, grants, channels, edge and report. They show what Ultra has set on a site: the sign-in policy, temporary access grants, alert channels, network edge settings and the client report’s schedule. They only read, so they need no --user. The sign-in policy travels in wp bettershield settings export, so one site’s setup can be imported into the next.
wp bettershield-ultra grants
Score thresholds and file-list exports
Free 1.1.3 changed scoring to 60 setup points and 40 site-health points, capped at 74 with an open critical finding. Recheck audit --fail-under thresholds after updating. The integrity list supports paging, filters and CSV export; use the installed command’s --help for its exact options. Printed times use the site’s time zone and unused options are refused.