Cache Tags for Cloudflare
Cache Tags for Cloudflare does two things: Tagging — adds a Cache-Tag HTTP response header to singular posts, pages, custom post types and taxonomy terms so Cloudflare can invalidate them by tag. Purging — calls the Cloudflare API to purge the relevant tags when content changes (post publish/update/
Cache Tags for Cloudflare does two things:
- 01Tagging — adds a Cache-Tag HTTP response header to singular posts, pages, custom post types and taxonomy terms so Cloudflare can invalidate them by tag.
- 02Purging — calls the Cloudflare API to purge the relevant tags when content changes (post publish/update/trash/delete and taxonomy term edits).
The two features can be enabled independently.
Works on any Cloudflare plan. The Cache-Tag header and purge-by-tag are available on all Cloudflare plans (Free, Pro, Business, and Enterprise); purge API rate limits scale with your plan.
Default tags
For singular content the plugin emits:
- content
- b{id} (site scope: b1 on single site, b{blog_id} on multisite)
- b{id}-p{ID}
- b{id}-pt-{post_type}
- b{id}-t{term_id} for every public taxonomy term the post belongs to
Example header:
Cache-Tag: content,b1,b1-p42,b1-pt-post,b1-t5
Term tags use the numeric term ID ( b1-t5 ), so they stay stable when a term is renamed or its slug changes.
Credentials
Provide a scoped Cloudflare API token (Zone → Cache Purge permission) and a Zone ID. Define them in wp-config.php for best security:
define( 'CACHE_TAGS_CF_API_TOKEN', 'your-scoped-token' ); define( 'CACHE_TAGS_CF_ZONE_ID', 'your-zone-id' );
When these constants are defined they take precedence and the settings fields become read-only. Otherwise enter them under Settings → Cache Tags .
Purge tools
The Settings → Cache Tags screen has a Purge tab for manual, on-demand purges by group: a whole post type, a taxonomy term, everything, or raw comma-separated tags. Saving valid credentials on the Settings tab automatically verifies the Cloudflare connection and unlocks the purge tools.
Automatic purging
When Auto-purge on changes is enabled and valid credentials are set, the plugin purges the affected tags automatically on these events:
- Post published, updated, trashed, or untrashed (any transition to or from the published status) — purges b{id}-p{ID} plus the post’s b{id}-t{term_id} tags.