Forums › Forums › Search & Filter Pro › Post Meta Conditions not working?
- This topic has 13 replies, 2 voices, and was last updated 5 years, 10 months ago by
Trevor.
-
Anonymous(Private) December 9, 2020 at 9:22 pm #269339
I have created a new Search Form that is identical to another one I’ve created that works really well, with just one difference – this new one has an additional Post Meta condition based on an ACF field:
instruments_taught = Drums & Percussion
As of now, zero results are returning, and I’m not at all sure what I’ve done wrong.
Here’s a link to the form that isn’t working:
https://buffalomusicclub.com/music-lessons/drums-percussion/Here’s a link to the identical form that is working, just without the Post Meta condition:
https://buffalomusicclub.com/music-lessons/Thanks for you attention!
Anonymous(Private) December 10, 2020 at 3:39 pm #269432OMG YES!!! That’s it!
I think the way it works, I’ll need to remove the “instruments_taught” post meta field from the search form, since it can only be here once. I was kind of hoping that it would still load, since a lot of our music teachers teach multiple instruments. But I think this is GREAT.
THANK YOU SO MUCH!
Anonymous(Private) December 10, 2020 at 3:44 pm #269436Actually, there is another question I have that I’m concerned about. As far as I understand it, the Post Meta conditions are all “AND” based. What do you suggest I do if I want to create a search form that would pull in a variety of values for a single post meta field? Is this a situation where I’m going to have to use exact IDs of products instead? It’s not as slick, but I could do it that way if I have to.
Anonymous(Private) December 10, 2020 at 5:55 pm #269476That’s not quite the question I was asking. I’m talking about the condition you changed to “like” for me, not the field in the actual search form. For example, the form you just helped me fix pre-filters the results for anything with a value of “Drums & Percussion” in the “instruments_taught” field. What I was trying to figure out was a search form that could pre-filter the results for anything with a value of “Violin” OR “Viola” OR “Cello” OR “Double Bass” in the “instruments_taught” field. That’s what I’m struggling with at the moment. It’s a little difficult to discern what situations are “AND” vs. “OR” – and also, the IDs idea I had would be really annoying because there is only an “Exclude Post IDs” field on the Posts tab. There is one other alternative – I could create a new ACF that would add a value to a “instrument_family” field, and then just query on that. I think that’s my best bet. Do you have any other insight to offer?
Trevor(Private) December 10, 2020 at 5:58 pm #269480Ah, no, that field accepts only a single value. But you could do it using this filter:
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
-
AuthorPosts