Skip to main content

benecaster_search_indexable

Filter Free Since v1.0.0

Filters whether a specific episode is included in search results. Evaluated per result after the core search query runs. Return `false` to exclude the episode without unpublishing it — for example, to suppress bonus episodes, hide administrative episodes, or implement a custom visibility rule.

This is a Free filter. It fires per result, so keep callbacks lightweight when a show has a large episode catalog.

Parameters

Name Type Default Description
$indexable bool Default true
$episode_id int Episode post ID
$q string Search term

Returns: bool

Examples

Exclude episodes by WordPress tag

add_filter( 'benecaster_search_indexable', function( bool $indexable, int $episode_id, string $q ): bool {
    if ( has_tag( 'admin-only', $episode_id ) ) {
        return false;
    }
    return $indexable;
}, 10, 3 );

Exclude by custom post meta flag

add_filter( 'benecaster_search_indexable', function ( bool $indexable, int $episode_id, string $q ): bool {
    return ! (bool) get_post_meta( $episode_id, '_my_addon_hide_from_search', true );
}, 10, 3 );

Affects

  • GET /benecaster/v1/search REST endpoint