facetwp index only parents

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/*
Plugin Name: Custom Hooks
Plugin URI: https://facetwp.com/
Description: A container for custom hooks
Version: 1.0
Author: FacetWP, LLC
*/

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘my_facet’ == $params[‘facet_name’] ) { // change my_facet to the name of your facet
if ( !empty( $params[‘parent_id’] ) ) {
$params[‘facet_value’] = ”;
}
}
return $params;
}, 10, 2 );
{{/gist}}