Title: Boolean Relationship Problem
Last modified: August 21, 2016

---

# Boolean Relationship Problem

 *  [christiansjavik](https://wordpress.org/support/users/christiansjavik/)
 * (@christiansjavik)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/boolean-relationship-problem/)
 * I’m having an issue where my search results are containing ANY ONE of the search
   parameters I’m using rather than ALL of the parameters I’ve selected via checkbox.
   For example, if I’m trying to search something that fits both the category “white”
   and the category “cloth,” my search results are of items that are are white and
   cloth or white or cloth. From the choice below, I have selected: “AND”
 * Boolean relationship between the taxonomy queries
    ANDOR AND – Must meet all 
   taxonomy search. OR – Either one of the taxonomy search is meet.
 * [http://wordpress.org/plugins/ajax-wp-query-search-filter/](http://wordpress.org/plugins/ajax-wp-query-search-filter/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * (@wp_dummy)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/boolean-relationship-problem/#post-4410738)
 * You can try to use `ajwpqsf_get_taxo()` filter hook.
 *     ```
       add_filter('ajwpqsf_get_taxo', 'custom_checkbox_query','',3);
       function custom_checkbox_query($taxo,$id, $gettaxo){
         $taxo ='';
         global $wp_query;
         $options = get_post_meta($id, 'ajaxwpqsf-relbool', true);
         $taxrel = isset($options[0]['tax']) ? $options[0]['tax'] : 'AND';
       	if(!empty($gettaxo)){
                 $taxo=array('relation' => $taxrel,'');
       	   foreach($gettaxo as  $v){
       		 if(!empty($v['term']))	{
       	  	  if( $v['term'] == 'awpqsftaxoall'){
       			 $taxo[] = array(
       			 'taxonomy' => strip_tags( stripslashes($v['name'])),
       			'field' => 'slug',
       			'terms' => strip_tags( stripslashes($v['term'])),
       			'operator' => 'NOT IN'
       			);
   
       		  }
       		  elseif(is_array($v['term'])){
       			 $taxo[] = array(
       			'taxonomy' =>  strip_tags( stripslashes($v['name'])),
       			'field' => 'slug',
       			'terms' =>$v['term'],
       			'operator' => 'AND'
       			);
       			}
       			else{
       			$taxo[] = array(
       			'taxonomy' => strip_tags( stripslashes($v['name'])),
       			'field' => 'slug',
       			'terms' => strip_tags( stripslashes($v['term']))
       			);
       			}
       		    }
       		} //end foreach
   
       		unset($output[0]);
       		return $output;				
   
       }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Boolean Relationship Problem’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ajax-wp-query-search-filter_ffffff.
   svg)
 * [Ajax WP Query Search Filter](https://wordpress.org/plugins/ajax-wp-query-search-filter/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ajax-wp-query-search-filter/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ajax-wp-query-search-filter/)
 * [Active Topics](https://wordpress.org/support/plugin/ajax-wp-query-search-filter/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ajax-wp-query-search-filter/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ajax-wp-query-search-filter/reviews/)

## Tags

 * [boolean](https://wordpress.org/support/topic-tag/boolean/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [taxonomy](https://wordpress.org/support/topic-tag/taxonomy/)

 * 1 reply
 * 2 participants
 * Last reply from: [TC.K](https://wordpress.org/support/users/wp_dummy/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/boolean-relationship-problem/#post-4410738)
 * Status: not resolved