WP-CLI Commands

Validating The Site #

This WP-CLI command  crawls the entire site for validation, or as much of it as you’d like.

$ wp amp validation runCode language: Bash (bash)
OptionDescription
--limit=<count>The maximum number of URLs to validate for each template and content type.
--include=<templates>Only validates a URL if one of the conditionals is true. For example, --include=is_tag,is_category
--forceForce validation of URLs even if their associated templates or object types do not have AMP enabled.

For example, if you want to limit this to 10 URLs for each type and only include tag and category templates:

$ wp amp validation run --limit=10 --include=is_tag,is_categoryCode language: Bash (bash)

For large sites, validation will take a long time without using the --limit option.

If you’re in Transitional mode (formerly ‘Paired’) and those templates are disabled, it won’t be possible to validate them without a flag.

For example, the “Categories” and “Tags” templates are disabled here in the “AMP Settings” menu:

Some templates disabled
The AMP Settings page, with some templates disabled

To force validating these templates, add the --force flag to the command:

$ wp amp validation run --limit=10 --include=is_tag,is_category --forceCode language: Bash (bash)
WP-CLI command to validate the site

You’ll see a link at the bottom that shows all of the validated URLs.

Resetting Site Validation #

If there was a change in the site, like if a plugin or theme was activated, you can reset the validation status of your site via a WP CLI command:

$ wp amp validation resetCode language: Bash (bash)
(Note: Screenshot needs to be updated.)

Passing the --yes flag ensures that this doesn’t confirm ‘Are you sure you want to empty…’

$ wp amp validation reset --yesCode language: Bash (bash)