Features Pricing Reviews FAQ
Get Plugin

WP-CLI Commands

8 min read

xSpeed Cache registers a set of WP-CLI commands so you can check status, purge caches, and run tasks from the command line. Every command lives under the wp xspeed namespace.

What this does

Each xSpeed Cache module that supports the command line adds its own wp xspeed <module> ... command. The commands share the same code as the dashboard, so what you see on the command line matches what the dashboard does.

The commands are only available when WP-CLI is installed and you run them from a site where xSpeed Cache is active. Some commands belong to xSpeed Cache Pro and only appear when Pro is installed and licensed.

How to use them

Run the commands from your site’s root directory, the same way you run any other wp command.

wp xspeed cache status

If a command takes an action, you pass it as the first word after the command name:

wp xspeed objcache flush

Some commands accept extra options written as --name=value:

wp xspeed db clean --types=transients,revisions

Note: Run wp xspeed <command> --help to see the exact actions and options WP-CLI has registered for any command on your install.

Free commands

These commands ship with the free xSpeed Cache plugin.

CommandWhat it doesActions
wp xspeed cacheInspect Cache module settingsstatus (optional)
wp xspeed minifyInspect or purge the minify cachestatus, purge
wp xspeed gzipShow GZIP status (server type, active, mode)
wp xspeed browser-cachePrint the Apache or nginx browser-cache snippetapache, nginx (optional)
wp xspeed objcacheManage object cachestatus, flush, snippet, enable, disable, test
wp xspeed dbScan or clean WordPress bloatscan, clean, optimize
wp xspeed preloaderDrive the cache preloaderstart, stop, status
wp xspeed cdnShow CDN settings and test rewriting a URLstatus, test
wp xspeed cfCloudflare verify, purge, and dev-mode helpersverify, purge, dev-on, dev-off
wp xspeed lazyShow which lazy-load toggles are active
wp xspeed fontsShow font-optimization settings
wp xspeed bloatShow which bloat-removal toggles are active
wp xspeed heartbeatInspect or modify heartbeat settingsshow, set
wp xspeed healthPrint diagnostic checks, cache stats, and recent activity
wp xspeed ai-privacyShow whether AI data collection is allowed for the current context
wp xspeed migrateImport settings from another caching pluginstatus, preview, apply
wp xspeed supportPrint the support snapshot

Cache

wp xspeed cache status prints the current Cache module settings, including the cache lifetime and the list of excluded URLs. Purging and toggling the cache are handled by the dedicated commands rather than this one.

Minify

wp xspeed minify status
wp xspeed minify purge

status shows the state of the minify cache. purge clears it.

GZIP

wp xspeed gzip reports the detected server type, whether GZIP is active, and the mode (auto on Apache and LiteSpeed, manual on nginx and IIS).

Browser cache

wp xspeed browser-cache apache
wp xspeed browser-cache nginx

This prints the browser-cache snippet for the chosen server. If you do not pass a flavor, it prints the Apache rules.

Object cache

wp xspeed objcache status
wp xspeed objcache flush
wp xspeed objcache snippet
wp xspeed objcache test
wp xspeed objcache enable
wp xspeed objcache disable

status shows whether the drop-in is installed and which backend is in use. flush clears the object cache. snippet prints the wp-config.php snippet. test checks the connection to the configured backend. enable installs the drop-in and writes the config; disable reverses it.

Database

wp xspeed db scan
wp xspeed db clean --types=transients,revisions
wp xspeed db optimize

scan reports the bloat it finds. clean removes it. Use --types=a,b to clean specific categories only. optimize runs table optimization.

Preloader

wp xspeed preloader start
wp xspeed preloader stop
wp xspeed preloader status

start begins a preload run, stop ends it, and status reports progress.

CDN

wp xspeed cdn status
wp xspeed cdn test --url=https://example.com/wp-content/uploads/image.jpg

status shows the current CDN settings. test rewrites the URL you pass in --url so you can confirm the CDN rewrite is working.

Cloudflare

wp xspeed cf verify
wp xspeed cf purge
wp xspeed cf dev-on
wp xspeed cf dev-off

verify checks your Cloudflare credentials. purge clears the Cloudflare cache. dev-on and dev-off turn Cloudflare development mode on and off.

Heartbeat

wp xspeed heartbeat show
wp xspeed heartbeat set --for=editor --behavior=disable

show prints the current heartbeat settings. set changes them. Use --for to choose the context, --behavior to set the behavior, and --frequency to set the interval.

Note: This command uses --for rather than --context.

Migration

wp xspeed migrate status
wp xspeed migrate preview --source=wp-rocket
wp xspeed migrate apply --source=wp-rocket

status shows what can be imported. preview shows what would change without applying it. apply imports the settings. Use --source to name the plugin to import from.

Read-only status commands

wp xspeed lazy, wp xspeed fonts, and wp xspeed bloat each print which toggles in that module are currently active. wp xspeed health prints diagnostic checks, cache stats, and recent activity in one view. wp xspeed ai-privacy shows whether AI data collection is allowed for the current request context. On the command line there is no consent cookie, so this reflects the no-cookie case.

Support

wp xspeed support prints the support snapshot, a read-only system-info dump you can paste into a support ticket. See Debug Mode and Logs for what it contains.

Pro commands

These commands appear only when xSpeed Cache Pro is installed and licensed.

CommandWhat it doesActions
wp xspeed proShow xSpeed Cache Pro version and integration status
wp xspeed license statusShow license status, expiry, and grace window
wp xspeed brandShow resolved branding for the current site
wp xspeed imagesShow image conversion capabilities or convert a filecaps, convert
wp xspeed ccssManage Critical CSS storagelist, clear, generate
wp xspeed ucssManage Unused CSS storagelist, clear, generate
wp xspeed psiRun a PageSpeed Insights audit on a URL
wp xspeed rumShow recent RUM metric percentiles
wp xspeed recsList recommendations for the current configuration
wp xspeed rulesList custom cache rules
wp xspeed analyticsShow overview or slowest URLsoverview, slowest
wp xspeed networkNetwork-wide site snapshots and purge (multisite)list, purge
wp xspeed cf-apoCloudflare APO and edge-cache settingsstatus, on, off, sync
wp xspeed ai statusShow configured AI provider and usage counters
wp xspeed ai testSend a tiny test prompt to verify the AI provider
wp xspeed smart-predict analyzeRe-compute predictions from the navigation buffer
wp xspeed smart-predict statusShow buffer size, indexed sources, last analysis time
wp xspeed smart-predict flushWipe the SmartPredict buffer and predictions
wp xspeed smart-image statusShow the library profile and current AI recommendation
wp xspeed smart-image analyzeRe-profile the library and ask the AI for a recommendation
wp xspeed smart-image applyApply the recommendation into the Images module
wp xspeed adaptive-cache statusShow traffic profile and TTL recommendation
wp xspeed adaptive-cache analyzeRe-profile traffic and refresh the AI rationale
wp xspeed adaptive-cache applyApply the recommended TTL into the Cache module
wp xspeed performance-health statusShow Core Web Vitals score and any anomalies
wp xspeed performance-health analyzeRe-compute status and refresh the AI narrative

Images

wp xspeed images caps
wp xspeed images convert --file=/path/to/image.jpg --format=webp

caps shows which image conversion capabilities your server has. convert converts an existing file. Use --file for the path and --format to choose webp or avif.

Critical CSS and Unused CSS

wp xspeed ccss list
wp xspeed ccss clear
wp xspeed ccss generate --url=https://example.com/

wp xspeed ucss list
wp xspeed ucss clear
wp xspeed ucss generate --url=https://example.com/

Both commands work the same way. list shows stored entries, clear removes them, and generate builds a new entry. Use --url to target a specific page.

PageSpeed Insights

wp xspeed psi --url=https://example.com/ --strategy=mobile
wp xspeed psi --url=https://example.com/ --force

Runs a PageSpeed Insights audit. --strategy accepts mobile or desktop. Add --force to skip any cached result and run a fresh audit.

RUM

wp xspeed rum --hours=24

Shows recent Real User Monitoring metric percentiles. Use --hours to set the time window.

Analytics

wp xspeed analytics overview
wp xspeed analytics slowest --metric=ttfb

overview shows a summary. slowest lists the slowest URLs. Use --metric to pick which metric to sort by.

Multisite network

wp xspeed network list
wp xspeed network purge --blog=2

list shows a snapshot of each site in the network. purge clears the cache. Use --blog to target a single site.

Cloudflare APO

wp xspeed cf-apo status
wp xspeed cf-apo on
wp xspeed cf-apo off
wp xspeed cf-apo sync

status reports the current APO and edge-cache settings. on and off toggle APO. sync pushes the current settings to Cloudflare.

AI commands

wp xspeed ai status shows the configured AI provider and usage counters. wp xspeed ai test sends a small test prompt to confirm the provider is reachable.

The SmartPredict, SmartImage, AdaptiveCache, and PerformanceHealth commands each follow the same pattern: a status view, an analyze action that recomputes the result, and (where it applies) an apply action that writes the recommendation into the matching module.

  • A Tour of the xSpeed Cache Dashboard
  • Server Compatibility
  • Debug Mode and Logs
  • Object Cache
  • CDN Integration