Docs / Reference

WP-CLI commands

Everything the dashboard does, from the command line.

Content Polisher adds the wp content-polisher command to WP-CLI. The commands use the same rules, permissions, history and undo as the dashboard: every fix appears on the History page and can be undone there or from the command line.

Run the commands as a user who can use Content Polisher (by default, editors and administrators): add --user=admin or your own login.

Scan the site

$ wp content-polisher scan --user=admin
Scanning  100% [==========================] 0:24 / 0:24
Success: Scanned 3022 posts: 491 issues (480 safe fixes, 11 to review) in 104 posts.
rule                      id                   issues  safe
Double spaces             double_spaces        284     284
Space before punctuation  punctuation_spacing  100     100
Typography                typography           97      96

Options: --batch-size=<5–100> (posts per batch, default 20), --porcelain (print only the scan id), --fail-on=any|safe (see CI checks).

wp content-polisher status shows the same summary for the latest scan without scanning again.

List issues

$ wp content-polisher issues --post=42 --user=admin
$ wp content-polisher issues --rule=double_spaces --safety=safe --format=csv --user=admin > double-spaces.csv
$ wp content-polisher issues --safety=review --format=count --user=admin

Filters: --post, --rule, --category, --safety=all|safe|review, --status=open|ignored. Formats: table, csv, json, yaml, count, ids. The before and after columns show the change in brackets with some surrounding text; choose columns with --fields.

Fix posts

$ wp content-polisher fix 42 57 --dry-run --user=admin
$ wp content-polisher fix 42 57 --user=admin
Success: Post 42: 3 issues fixed (operation #12).
Success: Post 57: 1 issue fixed (operation #13).

Only safe fixes are applied; suggestions that need review are never changed from the command line. Each post is fixed in its own operation. --dry-run lists what would change without touching anything. Use 0 as the post id for site-wide text such as ACF options pages.

Pro: wp content-polisher fix --all fixes every safe issue of the site in one bulk operation, which can be undone as a whole. Add --yes to skip the confirmation.

History and undo

$ wp content-polisher history --limit=5 --user=admin
id  type    status     posts  fixes  user   finished_at
13  single  completed  1      1      admin  2026-10-09T17:01:20Z
12  single  completed  1      3      admin  2026-10-09T17:01:18Z

$ wp content-polisher undo 13 --user=admin
Success: Operation #13 undone: 1 change restored.

As in the dashboard, undo never overwrites later edits: posts edited after the fix are reported and kept. Add --force to restore them anyway.

CI and deployment checks

scan and status exit with code 1 when --fail-on matches: safe — there are safe fixes waiting, any — there are any open issues. For example, on a staging site after a content import:

wp content-polisher scan --fail-on=safe --user=admin || {
  wp content-polisher issues --safety=safe --format=csv --user=admin
  exit 1
}

fix also exits with code 1 when a post could not be fixed, for example because it does not exist or the user cannot edit it.

Run wp help content-polisher <command> for all options.