Skip to content

cwp scrub

shipped 1.0.0
cwp scrub [flags]

Local only — it acts on no environment.

Plus the shared flags --json, --verbose and --dry-run.

What it does

Removes production personal data from the local copy, and installs the mail guard.

cwp pull runs it for you as part of a pull, which is where it normally happens. Running it on its own is for the case where the data arrived another way — a ddev pull, a dump someone sent you, a pull run with --no-scrub.

The pipeline anonymises users outside pull.keep_roles, deletes the log post types listed in pull.truncate_post_types, truncates the tables in pull.truncate_tables, and installs the mail guard that stops the local site sending real mail to real addresses.

Two of those steps are fatal on failure rather than degrading to a warning: anonymisation and log deletion. Reporting a clean scrub over surviving personal data is precisely the failure the step exists to prevent.

Deletion goes through WordPress rather than SQL, and past the trash: a trashed log is still the full record, and the IP addresses and user agents live in postmeta and term relationships that a row delete would leave behind.

Example

cwp scrub
cwp scrub --dry-run   # what it would remove, and from where

What it does not do

It acts on the local site only and names no environment. There is no flag that points it at a remote — scrubbing production is not a thing this command can be talked into.

It does not remove content. Posts, pages and attachments are untouched; so are the redirect rules that sit one word away from the redirect logs in the same plugin.

The mail guard is installed even when scrubbing is switched off, which is a rule rather than a default.