facetwp facetwp_query_args shortcode template filter

djrmom

{{gist file=”custom-hooks.php” lang=”php”}}
<?php

add_filter( ‘facetwp_query_args’, function( $query_args, $class ) {
if ( ‘gluten_free’ == $class->ajax_params[‘template’] && ‘gluten-free-everywhere’ == $class->http_params[‘uri’] ) {
$query_args[‘tax_query’] = array(
array(
‘taxonomy’ => ‘category’, // change ‘category’ to different taxonomy if needed
‘field’ => ‘slug’,
‘terms’ => array( ‘entertainment’, ‘travel’, ‘breakfast-box’, ‘lunchbox’, ‘gluten-free-guides’ ) // array of term slugs
)
);
}
return $query_args;
}, 10, 2 );
{{/gist}}