Home › Forums › Add-ons › Repeater Field › Querying a repater field where a value is NOT inside any repater-entry › Reply To: Querying a repater field where a value is NOT inside any repater-entry
I gave this some thought when you first posted it, but could not thing of a way to do this then. I can’t say if the way your doing it is efficient or not, but reading it gave me an idea for the only way that it might be done using only wp_query.
First do a query to find any post that has that post ID, then do a query to get any post not in that list
// your original query args created before here
$result = new WP_Query($args);
$post__not_in = array();
if (count($result->posts)) {
$post__not_in = wp_list_pluck($results->posts, 'ID');
}
// args for new query
$args = array(
'post_type' => 'your-post-type',
'posts_per_page' => -1,
'post__not_in' => $posts__not_in
)
$final_results = new WP_Query($args);
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.