Last active
August 24, 2020 17:44
-
-
Save djrmom/62dd8c784dd6b2bcfe2d7aa10d90ca6b to your computer and use it in GitHub Desktop.
facetwp index only parents
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 | |
| /* | |
| 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