Support

Account

Home Forums Add-ons Repeater Field Query repeater field with two values Reply To: Query repeater field with two values

  • It is impossible to do a query based on two sub fields of a repeater where you want to get posts where sub field A == X AND sub field B == Y, at least not in a single query. It would take several queries and a lot of php work. It’s the nature of how the sub fields are stored in the DB.

    I have replied to several topics with an alternate means which makes repeater values easier to query. In this case I would save both values of each sub field into a single alternate meta field so that I could use that to query by. You can see examples of the basic idea here https://support.advancedcustomfields.com/forums/topic/query-last-row-of-a-repeater-field/ and here https://support.advancedcustomfields.com/forums/topic/sorting-admin-column-with-repeater/ and I’m sure there are others.