Let's say I have a custom post type called
Film, with a repeater field called
Showings, with fields
I need to make a query for those Films that have at least one showing that is in the next week and (this showing) has also a discount.
The query I have now, retrieves the films with at least one showing in the next week and at least one showing (maybe other) with a discount. It doesn't check that these 2 showings are the same!
$args = array( 'numberposts' => -1, 'post_type' => 'film', 'meta_key' => 'showings_%_start_datetime', 'meta_value' => array( time(), strtotime('+1week') ), 'meta_type' => 'NUMERIC', 'meta_compare' => 'BETWEEN', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'showings_%_discount', 'value' => 'students', 'type' => 'CHAR', 'compare' => '=' ) ) );
I've been checking the generated SQL query and I don't think it's possible, because the showings, since it's a repeater field, don't have a proper ID, so we'd need to check that the number inside the meta_key are the same, for example
Any ideas please?