FacetWP – index a Toolkit Types “select” field

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

<?php

function fwp_index_serialized_field( $params, $class ) {
if ( ‘service_type’ == $params[‘facet_name’] ) {
$cf = (array) $params[‘facet_value’]; // already unserialized
foreach ( $cf as $row ) {
foreach ( $row as $val ) {
$params[‘facet_value’] = $val;
$params[‘facet_display_value’] = $val;
$class->insert( $params );
}
}
return false;
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘fwp_index_serialized_field’, 10, 2 );
{{/gist}}