benecaster_feed_episode_limit
Filters the maximum number of episodes included in a compiled feed tier. The default is 0 (unlimited — all episodes in a single page). The limit is enforced at query time — before the episode array is passed to any other filters — so episodes excluded here cannot be recovered downstream.
The $tier_slug argument lets you set different limits per tier. When Benecaster compiles the public (tokenless) feed, the tier slug is 'public' — use this to serve a teaser episode count to anonymous listeners while leaving authenticated subscriber tiers unrestricted. Return 0 to include all episodes with no cap. Sites with very large catalogs that need pagination can opt in by returning a positive integer (e.g. 300).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$limit |
int |
— | Episode cap for this feed compilation pass. Default: 0 (no limit). Return a positive integer to paginate at that page size. |
$show_id |
int |
— | ID of the show |
$tier_slug |
string |
— | Tier slug for this feed compilation pass. `'public'` for the tokenless public feed. |
Returns:
int
Examples
Limit public feed, unrestricted for subscribers
add_filter( 'benecaster_feed_episode_limit', function( $limit, $show_id, $tier_slug ) {
// Serve only the 10 most recent episodes on the public feed as a teaser;
// give paying subscribers the full back-catalog.
if ( 'public' === $tier_slug ) {
return 10;
}
return 0; // no limit for authenticated tiers
}, 10, 3 );
Limit free tier to 5 episodes
add_filter( 'benecaster_feed_episode_limit', function( int $limit, int $show_id, string $tier_slug ): int {
if ( 'free' === $tier_slug ) {
return 5;
}
return $limit;
}, 10, 3 );
Remove limit for a specific show
add_filter( 'benecaster_feed_episode_limit', function( int $limit, int $show_id, string $tier_slug ): int {
if ( 42 === $show_id ) {
return 0; // no limit for this show
}
return $limit;
}, 10, 3 );
Notes
Applied before benecaster_feed_episodes. The episode array that filter receives is already capped — you cannot use benecaster_feed_episodes to recover episodes excluded here.