Skip to main content

benecaster_get_show_language()

Show / Episode Description Free
benecaster_get_show_language( int $show_id, bool $raw = false ): string

Returns a show’s language as a language tag. By default it answers what the feed’s <language> declares, which is en-us when the podcaster left Language on Not set (Show Settings → Details). Pass $raw = true to get only what the podcaster chose, so a show with no language set does not read as US English.

Use the default for anything that must match the feed. Use $raw = true when “not set” should fall back to your own default, such as auto-detecting the language of a transcript. Worked example: Follow the show’s language, with your own default when the podcaster has not set one.

Parameters

Name Type Default Required Description
$show_id int — Yes WordPress post ID of the show.
$raw bool false No false for the language the feed declares; true for only what the podcaster chose, '' when the show's Language is Not set.

Return Value

Type: string

A language tag such as en-us or pt-br. By default en-us for a show whose Language is Not set; with $raw = true, '' for such a show. '' either way for an id that is not a show.

Example

$chosen = benecaster_get_show_language( $show_id, true ); // '' when Not set
$lang   = '' !== $chosen ? $chosen : 'auto';              // your own default

Notes

Most shows saved before Not set existed hold en-us as a real choice, because the show form used to save it every time. Only shows never saved, or put back to Not set, answer '' with $raw = true.

The show's REST answer, GET /benecaster/v1/shows/{id}, carries the same pair: language (the feed's value) and language_is_set.

Need this built rather than just documented? See our services →