Skip to main content

benecaster_tier_gate_output

Filter Premium

Filters the final rendered output of [benecaster_tier_gate], after the taken branch has run through do_shortcode().

Website only, same as benecaster_tier_gate_passes — does not fire when the RSS feed resolves a gate, since feeds are compiled and cached per tier rather than rendered per visitor.

Parameters

Name Type Default Description
$output string The rendered output of the taken branch.
$passes bool Whether the visitor passed the gate (which branch was taken).
$show_id int ID of the show the gate is on.
$atts array The shortcode's resolved attributes (min_tier, show_id).

Returns: string

Example

add_filter( 'benecaster_tier_gate_output', function ( string $output, bool $passes, int $show_id, array $atts ): string {
    // Wrap gated content in a tracking wrapper for analytics.
    return $passes ? '<div data-tier-gate="open">' . $output . '</div>' : $output;
}, 10, 4 );

Notes

Fired by TierGateShortcode::render() on the rendered result of whichever branch was taken.