benecaster_feed_channel_data
Filters the channel-level RSS data array before it is compiled to XML. The array is assembled from stored show settings; use this filter to override any field at render time without modifying stored data — including suppressing or temporarily overriding the `itunes:new-feed-url` redirect tag.
Always return the full `$channel_data` array with your modifications applied. Setting `new_feed_url` to an empty string suppresses the `itunes:new-feed-url` tag without changing the value stored in post meta — useful for disabling a redirect during testing without losing the configured URL.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$channel_data |
array |
— | Associative array of channel-level RSS feed fields. Keys: `title` (string — and ), `description` (string — and ), `link` (string — show website URL, ), `language` (string — ), `copyright` (string — ), `build_date` (string — ), `feed_url` (string — ), `artwork` (string URL — ), `author` (string — ), `owner_name` (string — ), `owner_email` (string — ), `explicit` (string: 'true' or 'false' — ), `category` (string — ), `subcategory` (string|null — nested ), `type` (string: 'episodic' or 'serial' — ), `is_private` (bool — when true emits Yes), `is_complete` (bool — when true emits Yes), `new_feed_url` (string — ; empty string suppresses the tag entirely; added in Batch 1). |
$show_id |
int |
— | ID of the show |
Returns:
array
Examples
Update copyright and suppress redirect tag
add_filter( 'benecaster_feed_channel_data', function( $channel_data, $show_id ) {
// Append the current year to the copyright notice.
$channel_data['copyright'] = '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' );
// Suppress the new-feed-url tag.
$channel_data['new_feed_url'] = '';
return $channel_data;
}, 10, 2 );
Suppress redirect tag for specific show only
add_filter( 'benecaster_feed_channel_data', function ( array $data, int $show_id ): array {
// Temporarily disable the redirect tag for this show without clearing stored settings.
if ( $show_id === MY_SHOW_ID ) {
$data['new_feed_url'] = '';
}
return $data;
}, 10, 2 );
Append environment suffix to feed title
add_filter( 'benecaster_feed_channel_data', function ( array $data, int $show_id ): array {
// Append a suffix to all feed titles, e.g. for staging.
$data['title'] .= ' [PREVIEW]';
return $data;
}, 10, 2 );
Notes
Fires after channel data is assembled from stored show settings, but before the XML is rendered. Keys not present in the returned array are ignored — always return the full $channel_data with your modifications applied to avoid silently dropping fields.
Related hooks: benecaster_feed_episode_data (filters the data array for a single episode before XML output); benecaster_feed_before_render (fires just before the compiled feed XML is output).
See also: the suppress-override-redirect-tag recipe — suppress or override the <itunes:new-feed-url> redirect tag without changing stored settings.