I’m trying to filter search terms bases on categorisation created by posts 2 posts.
I’m using the generic site search and then I’ve created a search filter
function my_filter_the_search($query){
$site_category = filter_input(INPUT_GET, 'site_category', FILTER_SANITIZE_STRING);
$args = array(
'connected_type' => 'sitecat_to_product',
'connected_items' => $query
);
$query->set( 'query', $args );
return $query;
}
to run before the results are displayed.
Does anyone know how I extend the search to then filter for all posts that contain the search term but are then attached to the specific post 2 posts