Last active
August 25, 2020 16:00
-
-
Save djrmom/03e46e7b16937052685c39d3d32eb407 to your computer and use it in GitHub Desktop.
facetwp index only parent and one level child terms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| ** only index parent and first level child tax terms | |
| ** must re-index after adding filter | |
| **/ | |
| add_filter( 'facetwp_index_row', function( $params, $class ) { | |
| if ( 'my_tax_facet' == $params['facet_name'] && $params['depth'] > 1 ) { // channge 'my_tax_facet' to the facet name being indexed | |
| $params['facet_value'] = ''; // skip indexing | |
| } | |
| return $params; | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment