index a serialized array of post IDs

mgibbs189

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

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘YOUR_FACET_NAME_HERE’ == $params[‘facet_name’] ) {
$values = (array) $params[‘facet_value’];
foreach ( $values as $post_id ) {
$params[‘facet_value’] = (int) $post_id;
$params[‘facet_display_value’] = get_the_title( $post_id );
$class->insert( $params );
}
return false; // skip default indexing
}
return $params;
}, 10, 2 );

{{/gist}}