Skip to main content

benecaster_episode_card_meta

Filter Free

Filters the meta array for each episode card. Keys: episode_number, season_number, duration, pub_date. Remove keys to suppress specific meta items; add keys to inject custom meta.

Return the array. Cast with (array). Four keys are recognised: episode_number (int), season_number (int|null), duration (string) and pub_date (string, already formatted with the site’s date format).

pub_date arrives pre-formatted, not as a timestamp — it comes from get_the_date() with the site’s date_format already applied. Re-formatting it means parsing a localised string. A key the template does not recognise is ignored silently, so a misspelling reads as “the filter did nothing”.

Returning an empty array renders the card with no meta line rather than erroring.

Parameters

Name Type Default Description
$meta array Episode card meta array; keys: episode_number, season_number, duration, pub_date
$episode_id int ID of the episode
$show_id int ID of the show

Returns: array

Example

add_filter( 'benecaster_episode_card_meta', function( $meta, $episode_id, $show_id ) {
    // Remove season number from meta display; show only episode number and duration.
    unset( $meta['season_number'] );
    // Inject a custom guest name field from episode meta.
    $guest = get_post_meta( $episode_id, '_show_guest_name', true );
    if ( $guest ) {
        $meta['guest'] = $guest;
    }
    return $meta;
}, 10, 3 );

Affects

  • archive/episode-card/meta.php template part