Support

Account

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

  • To do this with queries on the existing fields you would need to

    1) use $wpdb to query the post meta table to get all of the rows where
    {$repeater_name}\_%\_{$sub_field_name_1} == "X"

    2) Then you’d need to loop though the results of this query, get the post value and the meta key and then you’d need to do another query where
    {$repeater_name}\_{$index_from_first_query}\_{$sub_field_name_2} == "Y"

    3) From this you can construct a list of post ID and use that list in for the post__in argument of a WP_Query.

    It really is much easier to use an acf/save_post filter to convert the values into something that can be more easily searched.