Automattic / WPCOM-Legacy-Redirector

WordPress plugin for handling large volumes of legacy redirects in a scalable manner.
20 stars 16 forks source link

Stop post type being indexed by VIP Search #105

Open GaryJones opened 3 years ago

GaryJones commented 3 years ago

Would need something like:

add_filter( 'ep_indexable_post_types', 'legacy_redirector_do_not_index_in_elasticpress' );

function legacy_redirector_do_not_index_in_elasticpress( $types ) {
    $deny_list = array( 'vip-legacy-redirect' );
    // Unset the items with values matching the deny list.
    return array_diff( $types, $deny_list );
}

See https://docs.wpvip.com/enterprise-search/indexing/post-types/#1-excluding-post-types-from-the-allow-list

While this originated from the VIP Search, the ep_indexable_post_types filter applies to any instance of ElasticPress (not just on VIP), so we would not want to put this snippet into a vipgo-helper.php file.