Hi @oxwalor
I believe something like this should help:
function wds_algolia_remove_page_content( $post_content, $post ) {
if ( 'page' !== $post->post_type ) {
return $post_content;
}
return '';
}
add_filter( 'algolia_searchable_post_content', 'wds_algolia_remove_page_content', 10, 2 );
You can find the filter inside the Algolia_Searchable_Posts_Index and the get_post_records method.
Thread Starter
Terry
(@oxwalor)
Thanks!
I added the code above to functions.php but the content is still being indexed.
Should I have added the code elsewhere?
Thread Starter
Terry
(@oxwalor)
Actually, meant to do this for autocomplete so changed the filter to algolia_post_content
I guess one question I have that I perhaps should have clarified yesterday, is it specifically the “page” post type that you’re wanting to not be included? or is it perhaps a different post type?
functions.php is one of a handful of correct places to put this, so that part isn’t the issue. Only parts I can see failing is if the post type isn’t correct, or if by chance this callback isn’t being invoked at all.
One of those filters should be the right place, I’m thinking.