WP-CLI Support for FastPixel
4 min read
FastPixel Website Accelerator includes a set of WP-CLI commands, so you can
manage caching directly from the terminal.
Requirements: WP-CLI installed on your server (most managed WordPress hosts ship it, runwp --info to check) and FastPixel active on the site. Run the commands from your WordPress
directory, or pass --path=/path/to/wordpress.
All commands are grouped under wp fastpixel. You can always see the built-in help with:
wp help fastpixel purge
Purging the cache #
Purge everything #
wp fastpixel purge --all
Purges the whole FastPixel cache and immediately requests fresh optimization for your pages,
the same as the Purge Cache button in the dashboard. Pages are re-optimized in the background;
this may take a few minutes.
If your site runs behind a supported hosting or server cache (SiteGround, WP Engine, Kinsta,
LiteSpeed, Cloudflare and others), that cache is purged automatically at the same time.
Purge without re-optimizing right away #
wp fastpixel purge --all --no-request
Marks the whole cache as outdated but does not immediately ask for re-optimization, pages are
re-optimized when they are next visited. Use this in deploy scripts that run often: it keeps your
pageview usage lower than a full purge on every deploy.
Purge a single page #
wp fastpixel purge https://example.com/sample-page/
wp fastpixel purge --post=123
Purges one page by its URL, or by post/page/term ID. The page is re-optimized in the background.
Checking the cache status #
Site overview #
wp fastpixel status
Shows a summary: whether an API key is set, the cache location and size, how many pages are
cached, and the current Serve Stale / Logged-in Users settings.
A single page #
wp fastpixel status https://example.com/sample-page/
Shows whether that page is cached, whether it is waiting to be refreshed, when it was cached,
when it was last invalidated, and the last error (if any). Useful when you want to confirm that
a specific page was picked up after a purge.
Deleting cached files #
wp fastpixel delete-cached https://example.com/sample-page/
wp fastpixel delete-cached --all
Deletes the cached files from disk without requesting re-optimization, the equivalent of the
Delete Cached Files action in the dashboard. Visitors get the regular WordPress page until the
page is optimized again. Use purge instead when you want the page refreshed right away.
Running diagnostics #
wp fastpixel diag
Runs the same setup checks as the Diagnostics tab (connectivity, cache directory, configuration).
Prints a success message when everything passes, and exits with a non-zero code when something
fails, so you can use it in monitoring or CI scripts. For details about a failing check, open
FastPixel → Diagnostics in the WordPress admin.
Managing page exclusions #
Page exclusions work exactly like the Page Exclusions field in the FastPixel settings: excluded
pages are not optimized and not served from the cache.
Exclude a page #
wp fastpixel exclude /checkout/
wp fastpixel exclude https://example.com/checkout/
wp fastpixel exclude sample-page
You can pass a path, a full URL, or a slug (slugs are resolved to the page’s real permalink).
The * wildcard is supported for excluding pages in bulk:
wp fastpixel exclude "/landing/*"
Any already-cached files for the excluded page are removed automatically. Excluding the homepage
(/) asks for confirmation first — add --yes to skip the prompt in scripts.
List the current exclusions #
wp fastpixel exclude --list
Remove an exclusion #
wp fastpixel exclude /checkout/ --remove
The page is re-optimized in the background so it becomes cached again.
Using the commands in scripts #
Every command returns a standard exit code: 0 on success, non-zero on failure — so they compose
cleanly with &&, CI pipelines, and monitoring tools.
A typical deploy script step:
# after deploying new code/content:
wp fastpixel purge --all --no-request && wp fastpixel diag
Or refresh only what changed:
wp fastpixel purge https://example.com/pricing/
wp fastpixel status https://example.com/pricing/
Multisite #
On a multisite network, target a specific site with WP-CLI’s standard --url flag:
wp fastpixel purge --all --url=https://site-two.example.com
Command reference #
| Command | Description |
|---|---|
wp fastpixel purge --all [--no-request] | Purge the whole cache (optionally without immediate re-optimization) |
wp fastpixel purge <url> | Purge a single page by URL |
wp fastpixel purge --post=<id> | Purge a single post, page or term by ID |
wp fastpixel status [<url>] | Show the cache status, globally or for one page |
wp fastpixel delete-cached <url>|--all | Delete cached files without re-optimizing |
wp fastpixel diag | Run the setup diagnostics (non-zero exit code on failure) |
wp fastpixel exclude <page> [--remove] [--list] [--yes] | Manage page exclusions |