Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Issues with Filters › Reply To: Issues with Filters
December 12, 2022 at 1:14 pm
#40491
Keymaster
Unfortunately I am not available for custom jobs, I am sorry.
I may have found a possible solution though. Please switch to this logic, and then use this custom code too:
add_filter("asp_query_args", "asp_query_args_exclude_parents", 10, 2);
function asp_query_args_exclude_parents($args, $search_id) {
foreach ( $args['post_tax_filter'] as &$filter ) {
foreach ( $filter['include'] as $k => $id ) {
$term = get_term($id);
$parent = ( isset( $term->parent ) ) ? get_term_by( 'id', $term->parent, $term->taxonomy ) : false;
if ( $parent == false ) {
unset($filter['include'][$k]);
}
}
}
return $args;
}