benecaster_show_subscribe_links
Filters the platform links array rendered in show/subscribe-links.php. Each entry is {platform, url}. Use to add, remove, or reorder platform links.
Return the array. Cast with (array). Each row must be an array with a non-empty url and a non-empty platform.
⚠ Rows failing either condition are silently dropped immediately after the filter:
array_filter( $links, fn( $l ) => is_array( $l ) && ! empty( $l['url'] ) && ! empty( $l['platform'] ) )
so a row with only a url disappears with no error. platform is then passed through sanitize_key(), which lowercases it and strips anything outside a-z0-9_- — a platform of Pocket Casts becomes pocket_casts. An unrecognised slug still renders, with a label humanised from the slug itself.
Returning an empty array — or one whose rows are all dropped — suppresses the section entirely. url is escaped with esc_url() and label with esc_html().
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$links |
array |
— | Platform subscribe links array; each entry: {platform: string, url: string} |
$show_id |
int |
— | ID of the show |
Returns:
array
Example
add_filter( 'benecaster_show_subscribe_links', function( $links, $show_id ) {
// Inject a Fountain.fm link when a Fountain URL is stored on the show.
$fountain_url = get_post_meta( $show_id, '_show_fountain_url', true );
if ( $fountain_url ) {
$links[] = [ 'platform' => 'fountain', 'url' => $fountain_url ];
}
return $links;
}, 10, 2 );
Affects
- show/subscribe-links.php template part