Home › Forums › General Issues › WP_Query with meta_query on a subfield within a group field › Reply To: WP_Query with meta_query on a subfield within a group field
I’ve read a bit more about group fields and the key doesn’t act the same as a repeater.
$author = 85; // This will eventuall be pulled from get_query_var('author') $images_query = new WP_Query([ 'suppress_filters' => FALSE, 'posts_per_page' => -1, 'post_type' => 'images', 'meta_query' => [ //'relation' => 'OR', //'relation' => 'AND', [ 'key' => 'authors_people', 'compare' => 'LIKE', 'value' => '"'.$author.'"' ], ], ]);
In the second paragraph of the overview for group it says the database saves the result as group_field so in your case it is authors_people. As the people field is a multi select and holding an array of people IDs (I would have thought) then the LIKE comparator should be fine.
Try the above and let me know what you get.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
CPT registration is coming to ACF! We demoed the new feature during the most recent session of ACF Chat Fridays. Check out the summary for the details. https://t.co/k2KQ3WWBAz— Advanced Custom Fields (@wp_acf) March 7, 2023
© 2023 Advanced Custom Fields.