benecaster_episode_nav_prev
Filters the WP_Post object for the previous episode in episode/navigation.php. Return null to suppress the previous link.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post |
WP_Post|null |
— | Previous episode WP_Post object, or null if there is no previous episode |
$episode_id |
int |
— | ID of the current episode |
$show_id |
int |
— | ID of the show |
Returns:
WP_Post|null
Example
add_filter( 'benecaster_episode_nav_prev', function( $post, $episode_id, $show_id ) {
// Suppress the previous link for the oldest episode in a season.
if ( $post ) {
$post_season = get_post_meta( $post->ID, '_benecaster_season_number', true );
$current_season = get_post_meta( $episode_id, '_benecaster_season_number', true );
if ( $post_season !== $current_season ) {
return null;
}
}
return $post;
}, 10, 3 );
Affects
- episode/navigation.php template part