Post Meta Conditions not working?

Forums › Forums › Search & Filter Pro › Post Meta Conditions not working?

Viewing 10 posts – 1 through 10 (of 14 total)
  • Anonymous
    #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!

    Trevor
    #269391
    This reply has been marked as private.
    Anonymous
    #269416
    This reply has been marked as private.
    Trevor
    #269426

    Is that better? I changed the operator to ‘Like’.

    Anonymous
    #269432

    OMG 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
    #269434

    Let me know if there is a way to still keep that field in the search form. 😉

    Anonymous
    #269436

    Actually, 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.

    Trevor
    #269471
    This reply has been marked as private.
    Anonymous
    #269476

    That’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
    #269480

    Ah, 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

Viewing 10 posts – 1 through 10 (of 14 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.