facetwp index category and its children

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

/** reindex after adding filter code */

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘label_fr’ == $params[‘facet_name’] ) { // change if needed
if ( 183 != $params[‘term_id’] && 183 != $params[‘parent_id’] ) ) {
$params[‘facet_value’] = ”;
}
}
return $params;
}, 10, 2 );
{{/gist}}