benecaster_feed_cache_cleared
Fires after any Benecaster feed cache clear completes, regardless of what triggered it. Trigger sources include: external code calling [benecaster_clear_feed_cache](/hooks/benecaster_clear_feed_cache/), Benecaster’s own internal invalidation from the episode editor, Settings saves, or REST endpoints, the admin UI cache-clearing buttons, and the WP-CLI `wp benecaster cache clear` command.
This is a Premium hook — it fires only on paid plans. Use it to warm the cache immediately after a clear, log the event to a monitoring service, or trigger related invalidations in connected systems. The cache is already fully cleared when this hook fires.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$scope |
string |
— | One of 'global', 'show', or 'tier' |
$show_id |
int|null |
— | Show ID if scope is 'show' or 'tier', otherwise null |
$tier_slug |
string|null |
— | Tier slug if scope is 'tier', otherwise null |
Examples
Log all cache clears to error log
add_action( 'benecaster_feed_cache_cleared', function (
string $scope,
?int $show_id,
?string $tier_slug
): void {
error_log( sprintf(
'[Benecaster] Feed cache cleared — scope: %s, show: %s, tier: %s',
$scope,
$show_id ?? 'all',
$tier_slug ?? 'all'
) );
}, 10, 3 );
Warm all feeds after a global clear
add_action( 'benecaster_feed_cache_cleared', function (
string $scope,
?int $show_id,
?string $tier_slug
): void {
if ( 'global' !== $scope ) {
return; // Only warm on global clears.
}
// Trigger a feed request for each active show + tier combination.
my_addon_warm_all_feeds();
}, 10, 3 );
Notes
This hook fires on every cache clear including those triggered internally by Benecaster, not only when your own code calls benecaster_clear_feed_cache. If your callback should respond only to clears your code triggered, set a flag before calling the action and check it inside the callback. This is a Premium hook — it fires only on paid plans.