WordPress plugin intelligence profile

Cache Tags for Cloudflare

Precise Cloudflare cache purging for WordPress: adds Cache-Tag headers and purges only affected posts, pages, and terms.

WP PlugIndex snapshot

Current directory snapshot

Tested up to WordPress 7.1
Current version1.5.2
WordPress coverageTested up to WordPress 7.1
Minimum stackWP 6.8 · PHP 8.3
Directory statusactive
Last directory update5 Aug 20262mo ago
Active installationsNewAdoption metric — not a quality score
WordPress.org ratingNo WordPress.org ratings yet
Official packageDirect from WordPress.org

Repository metrics are context, not quality scores. Active installations measure adoption and can strongly reflect a plugin’s age and historical popularity. Ratings, recent updates and “Tested up to” metadata also do not guarantee modern code, error-free operation, security, feature completeness or suitability for a particular site. Why active installs don’t tell the whole story →

WP PlugIndex currently records Cache Tags for Cloudflare version 1.5.2 as active, updated 2mo ago and tested up to WordPress 7.1.

Overview

About this plugin

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/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. 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.
  • Post permanently deleted — purges b{id}-p{ID} and its b{id}-t{term_id} tags.
  • Taxonomy term edited or deleted — purges b{id}-t{term_id}.

Only public post types and taxonomies are considered; revisions and autosaves are ignored. Tags collected during a request are de-duplicated and sent as a single batched purge after the response (in Cloudflare’s 30-tags-per-request batches). Draft-only edits, comments, menu/widget/theme changes, and plugin/core updates do not trigger a purge — use the Purge tab, WP-CLI, or the cache_tags_for_cloudflare/purge_tags filter for those.

Static files such as images are served outside WordPress and are not tagged or purged by tag.

Hooks and programmatic purging

The plugin exposes hooks for customizing tags and purging from your own code:

  • Filters: cache_tags_for_cloudflare/tags, cache_tags_for_cloudflare/purge_tags
  • Result actions: cache_tags_for_cloudflare/purged, cache_tags_for_cloudflare/purge_failed
  • Programmatic purging: cache_tags_for_cloudflare/purge_post, /purge_terms, /purge_post_type, /purge_all, /purge

See the Developer guide for full documentation and examples.

WP-CLI

wp cache-tags purge --post-type=page wp cache-tags purge --taxonomy=category --terms=news,sport wp cache-tags purge --post=42 wp cache-tags purge --tags=b1-t5,content wp cache-tags purge --all wp cache-tags verify

On multisite, --all purges only the current subsite (via its b{id} tag). To purge every site sharing the Cloudflare zone at once, purge the global content tag: wp cache-tags purge --tags=content.

External services

com ) to verify your credentials and to purge cached content by cache tag. Cloudflare is required for the plugin’s purging feature to work; the tagging feature (emitting Cache-Tag headers) works without contacting any external service.

The plugin contacts Cloudflare in the following cases, and only after you have provided a Cloudflare API token and Zone ID:

  • Verifying credentials — when you save credentials on the settings screen or run wp cache-tags verify, the plugin calls GET https://api.cloudflare.com/client/v4/user/tokens/verify. It sends your API token (in the Authorization header) so Cloudflare can confirm the token is valid.
  • Purging cache — when content changes and auto-purge is enabled, or when you purge manually via the settings screen or wp cache-tags purge, the plugin calls POST https://api.cloudflare.com/client/v4/zones/{zone-id}/purge_cache. It sends your API token (in the Authorization header), your Zone ID (in the request URL), and the list of cache tags to purge (in the request body). It does not send post content, personal data, or visitor information.

No data is sent to Cloudflare until you configure credentials, and no request is made unless one of the actions above is triggered.

Cloudflare is a third-party service provided by Cloudflare, Inc. By using this plugin’s purging feature you agree to Cloudflare’s terms and privacy policy:

  • Terms of Service: https://www.cloudflare.com/website-terms/
  • Privacy Policy: https://www.cloudflare.com/privacypolicy/
WordPress.org metadata

Plugin tags

Topics listed for this plugin in the WordPress.org directory.

  • cache tag
  • cdn
  • cloudflare
  • purge
Compatibility & maintenance

Compatibility & maintenance

Tested with WP 7.1

Marked as tested with the current WordPress 7.1 release.

Current WordPress releaseWordPress 7.1
WordPress.org Tested up to7.1
Minimum requirementsWordPress 6.8 · PHP 8.3
Update activity5 Aug 20262mo ago

“Tested up to” is directory metadata supplied by the plugin author. WP PlugIndex does not turn an older declaration into a claim that the plugin is incompatible.

Changes recorded by WP PlugIndex

Recent tracked changes

No tracked version or compatibility changes have been recorded by WP PlugIndex yet.

Tracking & source

WP PlugIndex tracks public WordPress.org directory metadata and records selected version, compatibility and availability changes as they are detected.

Plugin watchlist

Watch this plugin

Sign in to your WP PlugIndex account or create a free account. Free accounts can watch up to 5 plugins and see what changed.

Watch limit

Watchlist limit reached

You have reached your current active watch limit.