title: Function not running when a large sql query happens in another function in wordpress
body: <p>I'm having an issue when I do an action such as save a coupon post, I have a function run that does a large sql query and update. And then another function to update something else.  The issue I'm having is when I have the code for the large query, the 2nd function doesn't run or it doesn't update the database and I don't know why. Here is an example:</p>
  <p>The first function that runs:</p>
  <pre><code>add_filter ( 'woocommerce_update_coupon', 'update_coupon_products_admin_coupon_screen', 10, 2  );
  function update_coupon_products_admin_coupon_screen (){
      global $wpdb;
      
  $admincouponidcs = $wpdb-&gt;get_results( &quot;select ID from {$wpdb-&gt;posts} where post_type = 'shop_coupon' and post_status = 'publish' and post_author in (1,6)&quot; );
  $adminproductidcs = $wpdb-&gt;get_results( &quot;select ID from {$wpdb-&gt;posts} where post_type = 'product' and post_status = 'publish' and post_author != '1' and post_author != '6'&quot;, ARRAY_A);
  
              if( empty( $admincouponidcs ) ) {
                  return;
              }
              
              if( empty( $adminproductidcs ) ) {
                  return;
              }
  $outputapcs = implode(', ', array_column($adminproductidcs, 'ID'));
  foreach ($admincouponidcs as $admincouponidscs){
        update_post_meta($admincouponidscs-&gt;ID, 'exclude_product_ids', $outputapcs);
  }
  }
  </code></pre>
  <p>The second function:</p>
  <pre><code>add_filter ( 'woocommerce_update_coupon', 'update_coupon_meta_data_for_update', 10, 2  );
  function update_coupon_meta_data_for_update(){
  global $post;
  update_post_meta( $post-&gt;ID, 'usage_limit', '1' );
  }
  </code></pre>
  <p>So when I run both, the first function runs just fine but the 'usage limit' never gets updated.  If I simply remove the first function from my code then my usage limit updates.  Am I having some PHP timeout limit reached or something? Can I change that?</p>
  <p>And just for reference, the site I'm working on has over 100,000 products on the site so it is indeed a fairly large query.</p>
  <p>Thanks!</p>