-
-
Save mgibbs189/6133c21191be00309735887e7d1f9aed to your computer and use it in GitHub Desktop.
Facetwp Re-indexing EDD - Frontend Submissions checkbox values
This file contains 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 | |
add_filter( 'facetwp_index_row', 'wwce_facetwp_index_row' ); | |
function wwce_facetwp_index_row( $params ) { | |
if ( 'genre' == $params['facet_name'] || 'instruments' == $params['facet_name'] || 'mood' == $params['facet_name'] ) { | |
$values = (array) $params['facet_value']; | |
foreach ( $values as $val ) { | |
$params['facet_value'] = $val; | |
$params['facet_display_value'] = $val; | |
FWP()->indexer->insert( $params ); | |
} | |
// skip the default indexing query | |
return false; | |
} | |
return $params; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment