I have the algolia search working on my site but in the backend its also indexing a post type which should never be indexed (as it contains private infromation).
Is there a setting somewhere where I can say "NEVER index {post_type}"?
If you're speaking about an Algolia for WordPress plugin, you can definitely define a function/hook to decide whether a post type should be indexed or not.
For instance you could write:
<?php
/**
* @param bool $should_index
* @param WP_Post $post
*
* @return bool
*/
function exclude_post_types( $should_index, WP_Post $post )
{
if ( false === $should_index ) {
return false;
}
// Add all post types you don't want to make searchable.
$excluded_post_types = array( 'myprivatetype' );
return ! in_array( $post->post_type, $excluded_post_types, true );
}
// Hook into Algolia to manipulate the post that should be indexed.
add_filter( 'algolia_should_index_searchable_post', 'exclude_post_types', 10, 2 );
You can read more on: https://community.algolia.com/wordpress/indexing-flow.html#indexing-decision
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With