Hello @johnwiggity
Hope you are doing well.
One simple solution is to unassign the category you want to exclude from the posts and update the posts.
Or you can use the below code in your child theme’s functions.php
to exclude specific category:
<?php
function your_slug_exclude_category ( $formatted_data, $raw_data, $object_id, $schema_name ) {
if ( $schema_name == 'post' ) {
$categories = get_the_category( $raw_data->ID );
if ( ! empty( $categories ) ) {
foreach ( $categories as $category ) {
// Replace 54 with your category ID
if( 54 == $category->term_id ) {
$formatted_data['category'] = [];
}
}
}
}
return $formatted_data;
}
add_filter( 'cm_typesense_data_before_entry', 'your_slug_exclude_category', 10, 4 );
Please not you would have to index your posts again for this to take affect.
Hope this helps. Please let us know if you need further assistance.
Regards