Forums › Forums › Search & Filter Pro › Include/exclude taxonomy not working
- This topic has 7 replies, 2 voices, and was last updated 5 years, 2 months ago by Trevor.
-
Anonymous(Private) August 20, 2019 at 11:37 pm #219395
Hi,
I have a form that searches using three custom taxonomies (age group, city, and category). There are four age groups and I want to create a one form for each, that will only return results that have been assigned that age group. I can’t use the exclude option because many items are assigned more than one age group. However, using the “include” option under the “Tags, Categories, & Taxonomies” to specify the age group I want to target with the form doesn’t seem to do anything. For the form that “includes” the Seniors age group, I’m still getting results that haven’t been assigned the Seniors taxonomy term. How can I achieve the result I need?
Many thanks for your time,
CarinaAnonymous(Private) August 22, 2019 at 7:17 pm #219593Thanks Trevor, always a pleasure 🙂
For folks with a similar issue, what I learned is that the “include” function specifies which taxonomy terms will be added to a select list, but it does NOT pre-select any term, so the default is still “all categories.” Trevor provided a jQuery snippet which I was able to modify, which sets the select option of the age field to the value I want on that page. My version is roughly:<script> jQuery( document ).ready(function(){ var age = 'senior'; jQuery('select[name="_sft_ages[]"').val(age); }); </script>
And I just modify the age variable depending on which age group’s page flow I’m on. So far it’s returning the results I want, and I can see the correct age group passed in the URL.
Thanks again Trevor!
–Carina -
AuthorPosts