Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created October 14, 2015 09:18
Show Gist options
  • Save mgibbs189/809d6b593049d80fb0ff to your computer and use it in GitHub Desktop.
Save mgibbs189/809d6b593049d80fb0ff to your computer and use it in GitHub Desktop.
FacetWP - index parent terms and child terms in separate facets
<?php
function fwp_index_categories( $params, $class ) {
if ( 'product_cat' == $params['facet_name'] && 0 < (int) $params['depth'] ) {
return false; // skip this term
}
elseif ( 'product_sub_cat' == $params['facet_name'] && 0 == (int) $params['depth'] ) {
return false; // skip this term
}
return $params;
}
add_filter( 'facetwp_index_row', 'fwp_index_categories', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment