FacetWP – index facet values only for a certain post type

mgibbs189

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

function fwp_index_single_cpt( $params, $class ) {
if ( ‘YOUR_AUTOCOMPLETE_NAME’ == $params[‘facet_name’] ) {
if ( ‘YOUR_POST_TYPE_NAME’ != get_post_type( $params[‘post_id’] ) ) {
return false;
}
}
return $params;
}
add_filter( ‘facetwp_index_row’, ‘fwp_index_single_cpt’, 10, 2 );
{{/gist}}