title: How to run Wordpress Query by ACF field using Select on front-end
body: <p>Basically what I'm trying to do is create filters on front end, so that users can filter all posts by specific ACF field.</p>
  <p>There's a cattery website and the owner will need to add new litters, when new generations of kittens arrive. I've created option page for this new field group and created a repeater field with text, so that I can add new rows with names of the litters, I want to filter by later.</p>
  <p>I've included basic loop for repeater field:</p>
  <pre><code>&lt;select name=&quot;litter&quot; id=&quot;litter&quot;&gt;
    &lt;?php
    
    if( have_rows('cat-litters', 'option') ):
      
      while ( have_rows('cat-litters', 'option') ) : the_row(); ?&gt;
  
        &lt;option value=&quot;&lt;?php the_sub_field('new-litter', 'option'); ?&gt;&quot;&gt;&lt;?php the_sub_field('new-litter', 'option'); ?&gt;&lt;/option&gt;
  
      &lt;?php endwhile;
    else :
        
    endif;
    ?&gt;
  &lt;/select&gt;
  </code></pre>
  <p>And it is working for now: <a href="https://i.stack.imgur.com/BArMN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BArMN.png" alt="enter image description here" /></a></p>
  <p>I will be adding a field to cats' posts named cat-litter, so that I can find specific posts with a litter &quot;02&quot; for example.</p>
  <p>But now I'm stuck with using this select from front-end to run a query to display fitting posts.
  I'm working in index.php of twentytwentyone child-theme btw.</p>
  <p>It doesn't matter if it will need to reload page or not (however if the ajax way won't be complicated I would very much appreciate that) but I have to point out that it needs to work with pagination and I already have it set up with pre_get_posts to display 9 posts per page (3x3 grid).</p>