Skip to main content

benecaster_clear_feed_cache

Action Premium Since v1.0.0

Triggers a Benecaster feed cache clear. Use `do_action()` to request a clear — this hook acts as a command. Three scoping levels are available:

“`php do_action( ‘benecaster_clear_feed_cache’ ); // global do_action( ‘benecaster_clear_feed_cache’, $show_id ); // show-scoped do_action( ‘benecaster_clear_feed_cache’, $show_id, $tier_slug ); // tier-scoped “`

Use this hook when your code modifies episode data, tier assignments, or show metadata through a path outside Benecaster’s standard write endpoints — for example a WP-CLI import script, a webhook handler, or a migration plugin. When changes happen through the episode editor, the REST API, or the Settings UI, Benecaster invalidates the cache automatically. Prefer the narrowest scope that covers your change: on a large multi-show site, a global clear triggers a wave of feed rebuilds on the next subscriber poll. This is a Premium hook.

Parameters

Name Type Default Description
$show_id int (optional) If provided, scope to one show; omit for global clear
$tier_slug string (optional) Tier slug to clear. Requires $show_id. Omit to clear all tiers for the show.

Examples

Clear cache after bulk episode import

// Clear all tier caches for show ID 42 after a bulk import.
do_action( 'benecaster_clear_feed_cache', 42 );

Clear a single tier after availability update

do_action( 'benecaster_clear_feed_cache', $show_id, 'premium' );

Notes

Calling add_action() on this hook runs your callback as part of the clear pipeline — before cache entries are removed. This is rarely needed but available for pre-clear side effects. Redundant calls on already-empty or already-stale cache entries are no-ops with no harmful effect beyond minor overhead. A tier-scoped clear is faster than a show-scoped clear, which is faster than a global clear.