Support » Plugin: Ajax WP Query Search Filter » Results with multiple taxonomies not accurate

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author TC.K


    Have you check on the ‘OR’ boolean relationship in the form setting page?

    No, AND is selected.

    Plugin Author TC.K


    I think you have misunderstood the plugin boolean relationship. It is use to compare each of the of the taxonomy, not taxonomy’s term.
    type AND type2 AND type3….

    -term AND term2
    -term3 AND term4

    Ok. so lets say I have a taxonomy “Mailing-Options” with three terms:
    – Customers
    – Friends
    – Family

    Now I would like to check Friends and Familiy, to get all the entries who have BOTH terms associated.

    Is this possible?

    Plugin Author TC.K


    No, it will search the post with “Friend” and with “Family”

    Is there a way to add an option who generates the query in the background so all terms match?

    Plugin Author TC.K


    Yes, you can. I have the filter for this – ajwpqsf_get_taxo()

    add_filter('ajwpqsf_get_taxo', 'new_query', '' ,3);
    function new_query($taxo,$id, $gettaxo){
       $taxo[] = array(
    		'taxonomy' => 'product_cat',
    		'field' => 'slug',
    		'terms' => 'new-arrival',
    		'operator' => 'IN'
    	return $taxo;

    Ok, lets say I have a taxonomy with “mailing-options”, with the terms “christmas” and “easter”.
    How would the function look like to check for both terms?

    Previously we created the form containing the checkboxes for the taxonomy with your plugin.


    Plugin Author TC.K


    I don’t think so. If you created in the plugin, then it will automatically handle by the plugin.

    Would it be an option to extend your plugin so that you could set the boolean relationship between the taxonomy terms queries to AND, OR and so on?
    This would be a great addon!

    I managed to make the changes in your plugin.
    Maybe you can give me a feedback if there are any potential issues:

    In process.php a changed the following:
    After line 136 added
    , 'operator' => 'AND'

    After line 144 added
    , 'operator' => 'AND'

    In line 183 removed:
    && empty($keyword)

    As I mentioned before, it would be great if in the WP backend of your plugin we could set the operator between the taxonomy terms.

    Regarding the change on line 183 I’m not sure if it breaks anything.

    Plugin Author TC.K


    If you do this, all your taxonomies terms will behave with the AND boolean relationship. It is fine if you have only one search form, but if you have other search form to create, then this could be an issue. Also, you will have to change this every time you update the plugin.

    Actually you can set the changes without making any changes on the plugin file by using the filter ajwpqsf_get_taxo().

    Example is at here.

    Thanks for your feedback.
    I get to warnings using your hook:
    Warning: Missing argument 2 for my_custom_process() in /home/interpub/www/ on line 191
    Warning: Missing argument 3 for my_custom_process() in /home/interpub/www/ on line 191

    The affected line is:
    function my_custom_process($taxo,$id, $gettaxo ){

    Plugin Author TC.K


    Oh yes, need to defined the number of arguments for the hook.
    Try this
    add_filter('ajwpqsf_get_taxo','my_custom_process','' 3);

    Works perfect 🙂 Thanks!

    Last thing, line 183 in process.php:
    && empty($keyword)

    I removed this to have it strict, so the search string and the terms are checked.
    Any way to manipulate this through a hook?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Results with multiple taxonomies not accurate’ is closed to new replies.