Cache Tag Reference
RelayWP uses a type:identifier convention for all cache tags.
Tag Format
type:identifier
Tag Types
| Tag | Example | When added |
|---|---|---|
post:{id} | post:42 | Any singular post/page |
page:{type} | page:home, page:404 | Homepage, 404 |
author:{id} | author:7 | Author archive and paginated pages |
category:{slug} | category:news | Category archive |
tag:{slug} | tag:javascript | Tag archive |
{taxonomy}:{slug} | product_cat:clothing | Any custom taxonomy |
post_type:{type} | post_type:product | Custom post type archive |
feed:{type} | feed:post, feed:product | RSS/Atom feeds |
site:all | site:all | Global 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 termsauthor:{author_id}— the post author’s archivepost_type:{type}— the post type archivefeed:{post_type}— the post type’s feedpage:home— ifhome_purge_windowis 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 );