benecaster_episode_title
Filters the episode title for display contexts.
Return the title string. Cast with (string) at every call site.
This filter fires in three places — two of them in the RSS feed. It runs in FeedCompiler (the standard RSS <title>), in ItunesNamespace (the <itunes:title>), and in templates/episode/title.php for the web page. A callback cannot tell the feed from the website by arguments alone, since all three pass the same two, so a change made for display also ships to every subscriber’s podcast app.
On the website the value is escaped with esc_html(), so markup becomes literal text. In the feed it is XML-escaped by the compiler. Returning '' produces an empty <title>, which some podcast apps display as a blank row rather than falling back.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$title |
string |
— | Episode title |
$episode_id |
int |
— | ID of the episode |
Returns:
string
Example
add_filter( 'benecaster_episode_title', function( $title, $episode_id ) {
// Strip episode number prefix if a display format option is set.
if ( get_option( 'myplugin_hide_ep_number' ) ) {
$title = preg_replace( '/^Ep\.?\s*\d+:\s*/i', '', $title );
}
return $title;
}, 10, 2 );
Need this built rather than just documented? See our services →