Skip to main content

Podcast

1. Filter to prevent adding podcast data to the WP feeds.

/**
* Filter to prevent adding podcast data in the WP feeds.
*/
add_filter( 'rank_math/podcast/enhance_all_feeds', '__return_false' );

2. Filter to remove the Podcast feed namespace.

/**
* Filter to remove the Podcast feed namespace.
*/
add_filter( 'rank_math/rss/add_podcasts_namespace', '__return_false' );

3. Filter to modify the Hub URLs.

/**
* Filter to modify the hub URLs.
*
* @param array $urls The HUB URLs.
*/
add_filter( 'rank_mathpodcast/hub_urls', function( $urls ) {
return $urls
} );

4. Filter to prevent Rank Math from automatically publishing feed to Pubhubsubbub.

/**
* Filter to prevent Rank Math from automatically publishing feed to Pubhubsubbub.
*
* @param array $urls The HUB URLs.
*/
add_filter( 'rank_math/podcast/hub_urls', '__return_false' );

5. Filter to change the User-agent used to publish the feed to Pubhubsubbub.

/**
* Filter to change the User-agent used to publish the feed to Pubhubsubbub.
*
* @param string $user_agent The user agent.
*/
add_filter( 'rank_math/podcast/useragent', function( $user_agent ) {
return $user_agent;
} );

6. Filter to Change the Title of the Podcast Episode

/**
* Filter: 'rank_math/schema/podcast_episode_title' - Allow changing the title of the podcast episode. Pass false to disable.
*
* @var string $episode_title The title of the podcast episode.
*
* @param WP_Post $post The post object.
* @param array $schema The schema array.
*/
add_filter('rank_math/schema/podcast_episode_title', function( $episode_title, $post, $schema ) {
return $episode_title;
}, 10, 3);

7. Filter to change the number of Podcast Episodes in the RSS Feed

/**
* Filter to change the podcast feed arguments
*/
add_filter( 'rank_math/podcast_args', function( $args = [] ) {
$args[ 'posts_per_page' ] = 5;
return $args;
} );
/**
* Filter to modify the permalink of Podcast RSS feed.
*
* @pram string $podcast Podcast RSS feed slug.
*/
add_filter( 'rank_math/podcast/feed', function( $podcast ) {
return 'new-podcast';
});

Note: Once you have modified the Podcast feed slug using the above filter, head over to Settings → Permalinks in your WordPress dashboard and click the Save Changes button for the changes to reflect.