Skip to main content

benecaster_rss_extra_channel_tags

Filter Free

Adds elements to the feed’s <channel> that benecaster_feed_channel_data has no key for. Return an array of tags; Benecaster writes and escapes the XML, so a mistake here cannot break the feed. They render after every other channel-level tag and before the first <item>.

Each entry is keyed by the element name, optionally prefixed:

  • 'prefix:name' => 'text'<prefix:name>text</prefix:name>
  • 'prefix:name' => [ 'value' => 'text', 'attributes' => [ 'attr' => 'v' ] ] — with attributes
  • an empty value renders a self-closing element: <prefix:name attr="v"/>

Anything unusable is dropped, not rendered: a name or attribute name that is not a valid XML name, a null or non-scalar value, or a return that is not an array. One element per name — keys cannot repeat and nothing nests. For anything this shape cannot express, post-process the finished string with benecaster_feed_xml.

A prefix must be declared. itunes:, podcast:, content:, atom:, sy: and fh: already are. For your own prefix, register a namespace handler on benecaster_feed_namespaces whose get_xmlns() names it — an undeclared prefix makes the feed invalid XML.

Parameters

Name Type Default Description
$tags array Tags to add, keyed by element name. Empty by default.
$show_id int ID of the show
$tier_slug string Tier slug for this feed compilation pass (`public` for the public feed)

Returns: array

Example

add_filter( 'benecaster_rss_extra_channel_tags', function ( array $tags, int $show_id, string $tier_slug ): array {
    $tags['itunes:keywords'] = 'history, interviews';
    return $tags;
}, 10, 3 );