StaticScope registers one WP-CLI namespace, staticscope. The core commands are always there; the add-ons add subcommands only while their plugin is active, and only when WP_CLI is defined.
Run wp help staticscope on the site to see the list for the add-ons you have. Do not copy commands from a site with a different set of add-ons and assume they exist.
Core commands
| Command | What it does |
|---|---|
wp staticscope diagnostics | Prints the plugin, PHP, WordPress and active plugin details that support will ask for |
wp staticscope status [<section>] [--no-next] | Build state, counts and the suggested next command. Sections: jobs, crawled-site, processed-site, deployers |
wp staticscope options list|get|set | Read or write core options. --reveal-sensitive-values unmasks passwords |
wp staticscope detect | Finds WordPress URLs and adds them to the crawl queue |
wp staticscope crawl | Copies the queued pages into the static site |
wp staticscope post_process | Prepares the copied files, rewrites links and runs the site check |
wp staticscope full_workflow | Runs detect, crawl, post-process and deploy, in that order |
wp staticscope deploy | Hands the prepared site to the chosen publishing add-on |
wp staticscope check [--strict] | Checks for missing files and links back to WordPress. --strict fails when either is found |
wp staticscope preview | Builds the browsable preview and prints its address |
wp staticscope process_queue | Runs any waiting background jobs now |
wp staticscope files | Lists files by size or usage. Flags: --type, --orderby, --limit, --format |
wp staticscope zip [<file>] | Saves the prepared site as a ZIP, by default with a dated name in the current folder |
wp staticscope addons list | Lists active add-ons, their type and slug |
Status and options
status is a prompt as much as a report. It counts detected URLs, queued URLs, copied files and prepared files, then suggests detect, crawl, post_process or deploy depending on where the build stopped. --no-next removes the advice, which keeps logs readable.
wp staticscope status
wp staticscope status jobs
wp staticscope status processed-site --no-next
options works on the named options only, such as deploymentURL, detectPages or queueJobOnPostSave. Setting an empty password clears it; a blank password in the admin form would keep the old one. An unknown name fails instead of creating a new option.
wp staticscope options get deploymentURL
wp staticscope options set deploymentURL https://example.com
wp staticscope options set basicAuthPassword ''
Three shortcuts also set the common detection profiles: wp staticscope staticscope_cli_options_set_detect_common (posts, pages and custom post types, only the files they use), wp staticscope staticscope_cli_options_set_detect_homepage_only (the home page only) and wp staticscope staticscope_cli_options_set_detect_maximum (all content plus every upload, theme, plugin and core file).
Building and checking
There is no single build command. Build by running the three steps in order, or use full_workflow, which also publishes. Running them separately lets you stop before anything goes public.
wp staticscope detect
wp staticscope crawl
wp staticscope post_process
wp staticscope check --strict
wp staticscope preview
wp staticscope zip /tmp/site.zip
check --strict is the useful gate in automation: it exits non-zero when a referenced file is missing or a page still points at WordPress. Without --strict it prints the same counts and succeeds.
Caches and clean-up
| Command | Notes |
|---|---|
wp staticscope crawl_queue list|count|delete | Pages found. delete asks unless --force or --yes |
wp staticscope crawl_cache list|count|delete | The copy cache. Deleting makes the next crawl copy every page |
wp staticscope static_site delete | Deletes the copied files and the copy cache together |
wp staticscope processed_site delete | Deletes the prepared files |
wp staticscope deploy_cache list|count|delete [--namespace=<namespace>] | Upload record, per add-on namespace. No namespace means every namespace for count and delete, and default for list |
wp staticscope delete_all_cache | Every cache and generated file, after a confirmation |
Add-on commands
| Command | What it does |
|---|---|
wp staticscope forms status|test|list | Provider state, a real test submission and the last build’s forms |
wp staticscope pagefind status|index | Program state and the last index, or rebuild the index for the existing export |
wp staticscope github status|environments|publish|undo | Connection and environments, publish to named environments or --all, undo the last publish |
wp staticscope s3 status|test|publish | Bucket state, the upload and public check, then publish |
wp staticscope server status|test|publish|rollback|generate-key | Server state, connection check, publish, roll back the last publish, or make an SSH key |
wp staticscope github environments --format=json
wp staticscope github publish staging
wp staticscope github publish --all --yes
wp staticscope github undo production
github publish asks before publishing to a live environment unless you pass --yes. It reports added, changed and removed files per environment, and halts with status 1 if any environment failed. server test refuses an untrusted host key: a command cannot show you a fingerprint to compare, so trust it on the screen first.
Exit behaviour
- An error exits 1: a failed
check --strict, a failed publish, an unknown option, a missing generated site. - A warning exits 0: no publishing add-on during
deploy, forms not set up, or a warning fromforms test. pagefind statusexits 1 when Pagefind cannot run, even though it is a status command.- A delete command asks first.
--forceand--yesare the same flag; a “no” answer exits without deleting. - An uncaught crawl or build failure stops the command with an error rather than carrying on to publish an empty site.
Script a build and publish
Keep credentials in the environment or in wp-config.php, not in the script. The constants are documented with each add-on.
#!/usr/bin/env bash
set -euo pipefail
wp staticscope detect
wp staticscope crawl
wp staticscope post_process
wp staticscope check --strict
wp staticscope github publish production --yes
set -e matters: several commands report success with a warning, so the strict check is what stops a broken build before the publish.
Use it in CI
WP-CLI still needs a working WordPress with the plugin and its dependencies, and the crawler needs to reach the site over HTTP. In CI that usually means a database service, a web server and a WP-CLI container sharing the same files. A build cannot be done from the checkout alone.
wp core install --url="$SITE_URL" --title="Build" \
--admin_user=ci --admin_password="$ADMIN_PASS" \
--admin_email=ci@example.com --skip-email
wp plugin activate staticscope staticscope-addon-github
wp staticscope options set deploymentURL "$SITE_URL"
wp staticscope full_workflow
wp staticscope check --strict
full_workflow publishes as its last step, so CI needs the token or keys available before it runs. If you want the check to gate the publish, run the three build steps, check, then publish separately.
A local or containerised WordPress must be able to reach its own URL for the crawl. Loopback requests and HTTP basic authentication are handled, but a site that only resolves inside a browser will fail here.