Support

Account

Home Forums General Issues Search in multiple ACF fields with specific meta_key value Reply To: Search in multiple ACF fields with specific meta_key value

  • hello everyone,

    I was trying to setup a custom query which should select data from a series of acf fields.

    the matter is I don’t find a proper MySQL correct solution.
    did another post on the matter, but it’s vertical to an issue: this one is more generalist.

    each ACF post meta is a pair meta_key and a meta_value which have different values BUT, are single items in the DB structure…

    so to a perform some search LIKE some text in those fields, is impossible to my limited MySQL knowledge 🙁

    how can I say

    SELECT that specific meta_value='some value' 
       WHEN it's parent meta_key = 'something' 
          AND some other meta_value='some other value' 
       WHEN it's parent meta_key = 'something else' 
          AND maybe it's meta_value also contains 'some%words'

    sorry for this silly pseudo code, but I can’t find an easier way to ask you how to select and RETURN only specific ACF whose value is what I query…

    ty!