facetwp index only one post type

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php
/** check the post type and return false if its not the post type we
** want to index for this filter
**/

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
if ( ‘collections_filter’ == $params[‘facet_name’] && ‘collection’ != get_post_type( $params[‘post_id’] ) ) {
$params[‘facet_value’] = ”; // skip indexing
}
return $params;
}, 10, 2);
{{/gist}}