-
Notifications
You must be signed in to change notification settings - Fork 0
Cloudflare
Manages exactly one Cloudflare Cache Rule and purges exact URLs. Everything works on the Free plan — no Workers, no APO subscription.
Off by default. Connect under Cloudflare.
Two modes:
-
API token (recommended). Needs
Zone → Cache Rules → Edit(permission group "Cache Settings Write"), plusZone → ReadandZone → Cache Purge. - Global API Key with the account email. Legacy; the token is narrower and safer.
Credentials are encrypted at rest in the options table. They can instead be supplied in wp-config.php, which takes precedence:
define( 'GTPERF_CLOUDFLARE_API_TOKEN', '…' );
define( 'GTPERF_CLOUDFLARE_DOMAIN', 'example.com' );See Constants Reference.
GT Performance compiles your bypass policy — paths, cookies, query parameters, plus everything the active commerce adapters declare — into a single Cloudflare rule expression. It owns that one rule and leaves every other rule alone.
The rule compiler has to fit inside Cloudflare Free's rule-length and rule-count budget. When the compiled expression would exceed it, the plugin says so rather than truncating the expression, because a truncated bypass rule is exactly how a checkout page ends up cached at the edge.
Preview before you sync. The Cloudflare tab renders the exact expression it will send. Read it, then synchronize.
Exact-URL purge on Cloudflare Free. Triggered automatically when a content change requires an edge purge, and manually from the admin or CLI:
wp gt-performance cloudflare purge --page-url=https://example.com/some-post/
wp gt-performance cloudflare sync
wp gt-performance cloudflare diagnosediagnose walks each stage separately — token validity, zone resolution, ruleset read, rule write, purge — and reports which one failed. This matters because Cloudflare returns the same generic rejection for a token missing any of several permissions; the per-stage result tells you which permission is actually absent.
If your host already runs its own Cloudflare layer, two systems editing cache behaviour is a reliable way to produce inexplicable results. GT Performance detects xCloud's Cloudflare Enterprise add-on and refuses to also manage a rule, reporting the conflict instead. See xCloud.
On a site behind a host-managed Cloudflare layer, cloudflare purge may report success while the copy actually being served to visitors is held by the host's layer, not the zone your token addresses. Verify with a cache-busting query string and check for x-gt-cache: BYPASS rather than re-fetching the bare URL, and purge from the host's dashboard when the two layers disagree.
CDN · xCloud · Commerce Safety · Diagnostics
GT Performance · GPL-2.0-or-later · Issues and pull requests welcome
Getting started
Caching
Optimization
Delivery
Operations
Reference