Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active November 21, 2016 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/5d0d9b41318e7c23721bc621f3509381 to your computer and use it in GitHub Desktop.
Save mgibbs189/5d0d9b41318e7c23721bc621f3509381 to your computer and use it in GitHub Desktop.
FacetWP - index a Toolkit Types "select" field
<?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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment