Skip to main content

benecaster_feed_episode_limit

Filter Free

Sets the page size of a compiled feed. The default is 0, which puts every episode on a single page. Return a positive integer (e.g. 300) to turn on RFC 5005 pagination at that size: page 1 holds the most recent episodes, and older ones move to later pages, linked from the feed and fetched with ?paged=2 and so on.

This does not restrict access. Every episode stays in the feed, on a later page, for any app or person that follows the page links, while an app that does not follow them shows only page 1. To take an episode away from a tier, clear that tier’s date. See Setting Tier Availability.

The $tier_slug argument lets you set a different page size per tier. The public (tokenless) feed compiles as 'public'. A listener whose feed merges two or more tiers, buy-ups or grants is paged at the value returned for their first slug.

Parameters

Name Type Default Description
$limit int — Page size for this feed compilation pass. Default: 0 (every episode on one page). 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

Paginate the public feed only

add_filter( 'benecaster_feed_episode_limit', function( $limit, $show_id, $tier_slug ) {
    // Split the public feed of a very large catalogue into pages of 300.
    if ( 'public' === $tier_slug ) {
        return 300;
    }
    return 0; // one page for subscriber tiers
}, 10, 3 );

Keep one show on a single page

add_filter( 'benecaster_feed_episode_limit', function( int $limit, int $show_id, string $tier_slug ): int {
    if ( 42 === $show_id ) {
        return 0; // no pagination for this show
    }
    return $limit;
}, 10, 3 );

Notes

Runs before benecaster_feed_episodes. On a listener's single-tier feed, that filter receives one page at a time. See its notes for the merged-feed case.

Need this built rather than just documented? See our services →