FacetWP – trick a facet into belonging to a different post type

mgibbs189

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

add_filter( ‘facetwp_index_row’, function( $params, $class ) {
$post_id = (int) $params[‘post_id’];
if ( ‘course’ == get_post_type( $post_id ) ) {
$params[‘post_id’] = get_related_event_id( $post_id ); // you’ll need to build this part out
}
return $params;
}, 10, 2 );

{{/gist}}