Support

Account

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);