Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active June 25, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/768a80cf21fa92cc4d46227f1ab9bd64 to your computer and use it in GitHub Desktop.
Save mgibbs189/768a80cf21fa92cc4d46227f1ab9bd64 to your computer and use it in GitHub Desktop.
FacetWP - compare different facets in "OR" mode (experimental)
<?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 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment