DocumentationReference

The command line

Four WP-CLI commands for scanning, listing findings, inspecting checks and toggling site-wide fixes, with every option.

The plugin registers wp wsak with four subcommands. They are the way to put accessibility checks into CI, a deploy script, or a staging audit.

Commands respect the same capabilities and post-type permissions as the admin screens. wp wsak scan 12 is not a way around them.

wp wsak scan

Check one page, several, or everything.

wp wsak scan [<id>...] [--all] [--post-type=<types>] [--format=<format>]
Option Meaning
<id>... Posts to check. Omit when using --all.
--all Check every published post of the given types.
--post-type=<types> Comma-separated post types to include with --all. Only types this user may edit.
--format=<format> table, json, csv, yaml or count. Default table.
wp wsak scan 12 44
wp wsak scan --all --post-type=page
wp wsak scan --all --format=json > accessibility.json

Note that the command line runs the server pass only. The five browser checks need a rendered page in a real browser, so a command-line scan covers 36 of the 41 checks. See How scanning works.

wp wsak issues

List findings.

wp wsak issues [--post=<id>] [--severity=<severity>] [--status=<status>] [--format=<format>]
Option Meaning
--post=<id> Only findings on this page.
--severity=<severity> critical, serious, moderate or minor.
--status=<status> open, fixed or ignored. Default open.
--format=<format> table, json, csv, yaml or count. Default table.
wp wsak issues --post=12
wp wsak issues --severity=critical --format=csv

wp wsak checks

List every check the plugin can run, with its success criterion and severity.

wp wsak checks [--format=<format>]
wp wsak checks
wp wsak checks --format=json

The same list is in Every check.

wp wsak fixes

List site-wide fixes, or switch one on or off.

wp wsak fixes [<id>] [--on] [--off] [--format=<format>]
Option Meaning
<id> The fix to change. Omit to list them all.
--on Switch it on.
--off Switch it off.
--format=<format> table, json, csv, yaml or count. Default table.
wp wsak fixes
wp wsak fixes skip-link --on
wp wsak fixes block-pdf-uploads --off

The ids are listed in Site-wide fixes.

Using it in CI

--format=count makes a useful gate. To fail a build on any critical finding:

wp wsak scan --all --post-type=page,post
test "$( wp wsak issues --severity=critical --status=open --format=count )" -eq 0

Two things to keep in mind. A command-line scan does not include the browser pass, so contrast and target size are not covered. And findings that need a person are not barriers, so gate on severity and status rather than on the total.

Last updated . Something here wrong or missing? Tell us and we will fix it.