title: How to alter query results before loop : wordpress
body: <p>I wonder if it exists wp_query results before loop, as pre_get_posts is to alter before query i need a filter or action to alter the results, please see below :</p>
  <pre><code>// THe main query
  $args = [&quot;post_type&quot; =&gt; &quot;product&quot;];
  $query = new Wp_Query($args);
  if($query-&gt;have_posts()) : 
      while($query-&gt;have_posts) : $query-&gt;the_post();
          the_title();
      endwhile;
  endif;
   
  </code></pre>
  <p>So i need to make a function to play with some fields in woocommerce, too complex or impossible for a sql query (it about to find date availability from official woocommerce booking plugin) so i created following function somewhere :</p>
  <pre><code>/** 
  * this function get post id and remove when it not available on specific date
  * @param post_id int, the post id
  * @param $date string, the search date
  */
  function get_post_availability($post_id, $date) { 
      
   }
  </code></pre>
  <p>If i call this function inside above loop, i will break pagination, so how is there something like &quot;after_get_posts&quot; in wordpress?</p>
  <p>Thank you</p>