benecaster_episode_nav_next
Filters the WP_Post object for the next episode in episode/navigation.php. Return null to suppress the next link.
Return a WP_Post, or null when there is no next episode. Not cast — return get_post( $id ) rather than an ID, which is not validated here and fails later as a property access on a non-object.
When this and benecaster_episode_nav_prev are both null, the entire navigation block is suppressed. Fires both in [benecaster_episode_nav] and in templates/episode/navigation.php, with the same three arguments.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$post |
WP_Post|null |
— | Next episode WP_Post object, or null if there is no next 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_next', function( $post, $episode_id, $show_id ) {
// Hide the "next" link for subscribers who shouldn't see unreleased episodes.
if ( $post && get_post_meta( $post->ID, '_benecaster_hide_nav', true ) ) {
return null;
}
return $post;
}, 10, 3 );
Affects
- episode/navigation.php template part
Need this built rather than just documented? See our services →