This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Issues with Filters

#40491
Ernest MarcinkoErnest Marcinko
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;
}