Skip to main content

Exclude an episode from all search results

Free Beginner

Return false to remove an episode from every search response regardless of tier or query term. Useful when an episode is published but should not be discoverable — for example, bonus content accessible only via direct link, or episodes pending an embargo date.

Code

<?php
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
);

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →