Forums › Forums › Search & Filter Pro › AND filtering not working
Tagged: AND filtering not working, urgent
- This topic has 4 replies, 2 voices, and was last updated 9 years, 10 months ago by Anonymous.
-
Anonymous(Private) January 7, 2015 at 5:24 pm #9897
Dear Ross,
I recreated this post because you flagged my previous post (https://support.searchandfilter.com/forums/topic/is-it-possible-to-use-and-over-all-the-controls-specified/) as solved and I don’t get replies on my replies.
I looked in your codefile class-search-filter-get-results.php and printed the $args. This is what’s going wrong:
If I tick Thailand and Indonesie this is the output of $args:
Array ( [paged] => 1 [posts_per_page] => 16 [post_status] => Array ( [0] => publish ) [category__in] => Array ( [0] => 417 ) [meta_query] => Array ( ) [s] => boemboe [post_type] => Array ( [0] => post ) [tax_query] => Array ( [0] => Array ( [taxonomy] => post_tag [field] => slug [terms] => Array ( [0] => indonesie-nl [1] => thailand-nl ) [operator] => IN [include_children] => ) ) [orderby] => rand [order] => desc ) 1If I also tick ‘Vegetarisch’ the result is this:
Array ( [paged] => 1 [posts_per_page] => 16 [post_status] => Array ( [0] => publish ) [category__in] => Array ( [0] => 417 ) [meta_query] => Array ( ) [s] => boemboe [post_type] => Array ( [0] => post ) [tax_query] => Array ( [0] => Array ( [taxonomy] => post_tag [field] => slug [terms] => Array ( [0] => vegetarisch ) [operator] => AND [include_children] => ) ) [orderby] => rand [order] => desc ) 1As you can see the indonesie-nl and thailand-nl slug terms are gone. That’s the reason why the filter is not working okay. Could you please help me on this one?
Best regards
Janno
Ross Moderator(Private) January 7, 2015 at 11:05 pm #9913Hey Janno
I’ve just noticed what the problem is…
Basically you can only use the
tag
field once. You can’t use it multiple times.What you need to do is create custom taxonomies for each field you want, eg: Land, Gerecht and Vegetarisch
Please see these other posts which explain it too:
https://support.searchandfilter.com/forums/topic/child-categories/#post-7788
https://support.searchandfilter.com/forums/topic/need-help-setting-up-search-in-wordpress/#post-2131As far as free plugins go I recommend this one to set them up (even if it hasn’t been updated in 2 years) – https://wordpress.org/plugins/ultimate-taxonomy-manager/
Let me know once you’ve got this setup and if you have any questions.
Thanks
Anonymous(Private) January 7, 2015 at 11:35 pm #9920Hi Ross,
thank you! I created a new taxonomy Landen (countries) and am able to do an AND selection. It works!!!!
You can mark this thread as solved.Thank you very much. Can you please look to my other topic on Woocommerce integration?
Best regards, Janno
Anonymous(Private) January 8, 2015 at 4:08 pm #9951Extra info: Ultimate Taxonomy manager breaks the permalinks of Woocommerce. I found another one that did the trick and is better maintained: CPT UI (Custom Post Types UI).
Your plugin works like a charm!
Best regards and you may put this one on Resolved!
-
AuthorPosts