Skip to main content
RelayWP

Cache Tag Reference

RelayWP uses a type:identifier convention for all cache tags.

Tag Format

type:identifier

Tag Types

TagExampleWhen added
post:{id}post:42Any singular post/page
page:{type}page:home, page:404Homepage, 404
author:{id}author:7Author archive and paginated pages
category:{slug}category:newsCategory archive
tag:{slug}tag:javascriptTag archive
{taxonomy}:{slug}product_cat:clothingAny custom taxonomy
post_type:{type}post_type:productCustom post type archive
feed:{type}feed:post, feed:productRSS/Atom feeds
site:allsite:allGlobal purge (theme switch, option changes)

Purge Triggers

When a post is saved or deleted, the following tags are purged:

  • post:{id} — the post itself
  • {primary_term_type}:{slug} — all assigned category/tag/taxonomy terms
  • author:{author_id} — the post author’s archive
  • post_type:{type} — the post type archive
  • feed:{post_type} — the post type’s feed
  • page:home — if home_purge_window is set and the post is recent

Customization via Filters

// Add or remove tags purged when a post is saved.
add_filter( 'tagpurge_post_tags', function( array $tags, WP_Post $post ): array {
    $tags[] = 'sidebar:recent-posts';
    return $tags;
}, 10, 2 );

// Prevent a specific post from triggering a purge.
add_filter( 'tagpurge_should_purge_post', function( bool $should, WP_Post $post ): bool {
    return $post->post_type !== 'log_entry';
}, 10, 2 );