Skip to content

Instantly share code, notes, and snippets.

@djrmom
Last active August 24, 2020 17:44
Show Gist options
  • Select an option

  • Save djrmom/62dd8c784dd6b2bcfe2d7aa10d90ca6b to your computer and use it in GitHub Desktop.

Select an option

Save djrmom/62dd8c784dd6b2bcfe2d7aa10d90ca6b to your computer and use it in GitHub Desktop.
facetwp index only parents
<?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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment