facetwp fselect only parent terms

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘my_facet’ == $params[‘facet_name’] ) { // change my_facet
if ( !empty( $params[‘parent_id’] ) ) {
$params[‘facet_value’] = ”; // skip indexing
}
}
return $params;
}, 10, 2 );
{{/gist}}