Skip to main content

benecaster_show_stats_episode_count

Filter Free

Filters the episode count displayed in the public stats block.

Return an integer. Cast with (int), so a numeric string works and a non-numeric return silently becomes 0 rather than erroring.

The value is displayed through number_format_i18n(), so do not pre-format it — returning '1,234' casts to 1, because PHP stops the cast at the comma. Return the raw count and let the display layer localise it.

Parameters

Name Type Default Description
$count int Published episode count for the show
$show_id int ID of the show

Returns: int

Example

add_filter( 'benecaster_show_stats_episode_count', function( $count, $show_id ) {
    // Add back-catalog episodes tracked in a custom post type.
    $legacy_count = (int) get_post_meta( $show_id, '_show_legacy_episode_count', true );
    return $count + $legacy_count;
}, 10, 2 );

Affects

  • show/stats.php template part