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

Reply To: Multisite Search

#37703
SittingduckSittingduck
Participant

Hi,

Thanks so much for the code, but unfortunately it does not seem to be working. Im not getting any errors but its still showing other categories.

I did minor changes to the code:

add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
	$include = array(
		// Blog ID => Taxonomy term ID
		1 => 269
		
	);
	if ( isset($include[get_current_blog_id()]) ) {
		$args['post_tax_filter'] = array(
			array(
				'taxonomy'  => 'listing_location',
				'post_type' => 'listing',
				'include'   => array($include[get_current_blog_id()]), 
				'exclude'   => array(),
				'allow_empty' => false // Don't allow results, which does not have connection with this taxonomy
			)
		);
	}
  return $args;
}

i think i did it right based on this: wp-admin/edit-tags.php?taxonomy=listing_location&post_type=listing

And this is the link to that category: search/?postType=listing&listing_location=268

Any help would be greatly appreciated.

Thanks so much!