Open freddyheppell opened 6 years ago
Hello,
Thanks for reaching out!
Indeed it looks like that the hook you are using only affects indices for single post types.
You could however leverage another filter to specify what post types to make searchable: https://github.com/algolia/algoliasearch-wordpress/blob/d80ffe63dab48ca20e96eb695abb85d73be3e7dc/includes/class-algolia-plugin.php#L181
I think though that we could comply with the algolia_post_types_blacklist
by default.
What do you think?
Thank you, that works. For the record, this is what I'm doing:
function mb_algolia_searchable_post_types(array $post_types) {
$pos = array_search('el_events', $post_types);
if ($pos !== false) {
unset($post_types[$pos]);
}
return $post_types;
}
add_filter( 'algolia_searchable_post_types', 'mb_algolia_searchable_post_types' );
I think having the searchable post types comply with the blacklist by default is sensible, it's unlikely that you would want a type of post to not appear in the autocomplete but to appear on the search page.
What did you expect to happen?
My Search Page setting is set to "Use Algolia with Instantsearch.js ". I've added this to the functions.php of my theme.
I expected posts of this type to no longer be indexed to Algolia and no longer appear on the search page.
What happened instead?
The
el_events
type no longer appears on the Autocomplete tab type list, however if I reindex on the Search Page tab, posts of this type are still being shown on the search page.How can we reproduce this behavior?
Blacklist a custom type and use the search page with instant search
Can you provide a link to a page which shows this issue? This is the site I'm trying to blacklist on. The "Events" type should not be indexed. (additionally it would seem that #735 still happens, even though I'm on the latest version of the plugin)
Technical info