Facetwp Re-indexing EDD – Frontend Submissions checkbox values

<?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;
}
	
?>