FacetWP – compare different facets in “OR” mode (experimental)

mgibbs189

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

add_filter( ‘facetwp_filtered_post_ids’, function( $post_ids, $class ) {
if ( ! empty( FWP()->or_values ) ) {
$post_ids = [];
foreach ( FWP()->or_values as $facet_name => $matches ) {
foreach ( $matches as $match ) {
$post_ids[] = $match;
}
}
$post_ids = array_unique( $post_ids );
}
return $post_ids;
}, 10, 2 );
{{/gist}}