benecaster_show_social_links
Filters the social profile link array for a show after stored links are loaded and any entries with empty URLs are removed. Each item in the array carries three keys: `platform` (string slug), `url` (string), and `label` (string). This filter fires in both the `[benecaster_social_links]` shortcode and the Social Links Episode Page block renderer.
Use this filter to inject additional platforms programmatically, remove platforms conditionally, or reorder the list before it is passed to the renderer. Items returned with an empty or null `url` are silently omitted by the renderer regardless of what the filter returns. Built-in platform slugs: `twitter_x`, `instagram`, `facebook`, `youtube`, `tiktok`, `linkedin`, `threads`, `bluesky`, `mastodon`, `discord`, `newsletter`.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$links |
array |
— | Array of {platform, url, label} objects with non-empty URLs |
$show_id |
int |
— | ID of the show |
Returns:
array
Examples
Inject dynamic newsletter link
add_filter( 'benecaster_show_social_links', function( array $links, int $show_id ): array {
$newsletter_url = my_get_newsletter_url( $show_id );
if ( $newsletter_url ) {
$links[] = [
'platform' => 'newsletter',
'url' => $newsletter_url,
'label' => 'Newsletter',
];
}
return $links;
}, 10, 2 );
Remove Discord below subscriber threshold
add_filter( 'benecaster_show_social_links', function( $links, $show_id ) {
// Remove discord when the show has fewer than 100 subscribers.
$sub_count = benecaster_get_subscriber_count( $show_id );
if ( $sub_count < 100 ) {
$links = array_filter( $links, fn( $l ) => 'discord' !== $l['platform'] );
}
return array_values( $links );
}, 10, 2 );
Affects
- [benecaster_social_links] shortcode
- Social Links Episode Page block