FacetWP – index 2 autocomplete sources

mgibbs189

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

add_filter( ‘facetwp_indexer_row_data’, function( $rows, $params ) {
if ( ‘keyword’ == $params[‘facet’][‘name’] ) {
$new_row = $params[‘defaults’];
$post_id = (int) $new_row[‘post_id’];
$new_row[‘facet_value’] = $post_id,
$new_row[‘facet_display_value’] = get_the_title( $post_id );
$rows[] = $new_row;
}
return $rows;
}, 10, 2 );
{{/gist}}