Skip to main content

benecaster_show_stats_visible

Filter Free

Controls whether show/stats.php renders. Returns false by default — return true to show public episode stats on the show page.

Return a boolean. Cast with (bool).

The default is false, which is unusual for a _visible filter — the stats section does not render at all unless a callback opts it in. Returning false causes the template to return before any query runs, so this is a true short-circuit rather than a CSS-level hiding: nothing is computed and nothing is emitted.

Parameters

Name Type Default Description
$visible bool Whether the stats block renders; default false
$show_id int ID of the show

Returns: bool

Example

add_filter( 'benecaster_show_stats_visible', function( $visible, $show_id ) {
    // Enable the public stats block only on shows that have opted in via custom meta.
    return (bool) get_post_meta( $show_id, '_show_public_stats_enabled', true );
}, 10, 2 );

Affects

  • show/stats.php template part