Skip to main content

benecaster_show_tiers

Filter Premium

Filters the tiers array rendered in show/tiers.php. Use to reorder, rename, or suppress tiers on the show page.

Return the array. Cast with (array).

⚠⚠ The rows are OBJECTS, not associative arrays, despite the array return type — each is a tier-map row read as $tier->internal_tier_slug. Immediately after this filter, core 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. Rows arrive ordered by internal_tier_order; reordering the array reorders the display.

Parameters

Name Type Default Description
$tiers array Array of tier objects for the show
$show_id int ID of the show

Returns: array

Example

add_filter( 'benecaster_show_tiers', function( $tiers, $show_id ) {
    // Move the 'premium' tier to the front of the display list.
    usort( $tiers, function( $a, $b ) {
        return ( 'premium' === $a['slug'] ) ? -1 : 1;
    } );
    return $tiers;
}, 10, 2 );

Affects

  • show/tiers.php template part