Skip to main content

benecaster_show_tiers

Filter Premium

Filters the show’s tiers before show/tiers.php renders the show page’s Subscribe section. The section embeds [benecaster_subscribe], and this filter decides two things about it: whether the section appears at all, and which tiers get a card.

The rows are the show’s tiers, in the show’s tier order, from whichever source the show uses today:

  • A show on a membership plugin: its tier-mapping rows for the connected plugin, plus any not tied to a plugin. A mapping kept from a plugin the show switched away from is not included.
  • A show on built-in membership: its active tiers from Memberships → Tiers, each carrying only internal_tier_slug, internal_tier_name and is_free_tier.

The show’s Public tier is never included.

What a change does:

  • Return an empty array to hide the section.
  • Remove a tier to hide that tier’s card. Only the remaining tiers are passed to the shortcode.
  • Reordering the array doesn’t reorder the cards.
  • A row added for a slug the show doesn’t have renders no card.

The section is also left out whenever [benecaster_subscribe] renders nothing for the show, for example when no tier has a price. To change what a card says, filter the shortcode instead.

Return the array. Cast with (array).

The rows are OBJECTS, not associative arrays, despite the array return type — each is read as $tier->internal_tier_slug. Immediately after this filter, Benecaster drops every row that is not an object carrying internal_tier_slug:

array_filter( $tiers, fn( $t ) => is_object( $t ) && isset( $t->internal_tier_slug ) )

So a row appended as [ 'internal_tier_slug' => 'gold' ] vanishes with no error and no notice — the single most likely mistake here. Append an object ((object) [ ... ]) instead.

Returning an empty array — or an array whose rows are all filtered out — suppresses the tiers section entirely, because the template returns when nothing survives.

Parameters

Name Type Default Description
$tiers array — The show's tiers, as objects with at least internal_tier_slug, internal_tier_name and is_free_tier
$show_id int — ID of the show

Returns: array

Example

add_filter( 'benecaster_show_tiers', function ( $tiers, $show_id ) {
    // Hide the Subscribe section on one show's page.
    return 42 === (int) $show_id ? [] : $tiers;
}, 10, 2 );

Affects

  • show/tiers.php template part

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