title: category__not_in in index.php of Woocommerce template not working
body: <p>I'm new to PHP and WordPress so my question could easily be silly. Although I have found others with similar questions. </p>
  
  <p>On my main page (index.php) I would like to exclude products of a certain category. I found that it should be possible to use category__not_in as a parameter passed to the $args var. but this option doesn't work. When I change other values in the $args var. they are applied. I.e. if I change the post_per_page it is visible immediately. I use the code below and only want to exclude category 28 (could be more in the future). I tried the solutions mentioned in <a href="https://stackoverflow.com/questions/36178150/wordpress-category-not-in-not-working">stackoverflow</a>, but no success. A</p>
  
  <p>I was wondering if anyone could point me in the right direction. Thanks</p>
  
  <pre><code>&lt;section id="content"&gt;
  &lt;div class="container woocommerce"&gt;
  
      &lt;?php
      remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
  
      global $woocommerce_loop, $woocommerce;
      $meta_query = $woocommerce-&gt;query-&gt;get_meta_query();
      $args = array(
          'post_type' =&gt; 'product',
          'post_status' =&gt; 'publish',     
          'category__not_in' =&gt; array( 28 ),
          'ignore_sticky_posts'   =&gt; 1,
          'post__not_in' =&gt; $slider_arr,
          'posts_per_page' =&gt; 9, 
          'paged' =&gt; ( get_query_var('paged') ? get_query_var('paged') : 1),
  
      );  
  
      $products = new WP_Query( $args );
      //query_posts( $args );
  
          if ( $products-&gt;have_posts() ) : $x = 0; ?&gt;
  
              &lt;div id="posts_cont"&gt;
  
                  &lt;?php while ( $products-&gt;have_posts() ) : $products-&gt;the_post(); ?&gt;         
                      &lt;?php woocommerce_get_template_part( 'content', 'product-home' ); ?&gt;
                      &lt;?php if ($x == 2) { echo '&lt;div class="home_small_box clear"&gt;&lt;/div&gt;'; $x = -1; } ?&gt;
  
                  &lt;?php $x++; endwhile; // end of the loop. ?&gt;
  
              &lt;/div&gt;&lt;!--//posts_cont--&gt;
          &lt;?php //woocommerce_product_loop_end(); ?&gt;
  
          &lt;div class="load_more_cont"&gt;
              &lt;div align="center"&gt;&lt;div class="load_more_text"&gt;
              &lt;?php
              ob_start();
              //next_posts_link('&lt;img src="' . get_bloginfo('stylesheet_directory') . '/images/loading-button.png" /&gt;');
              next_posts_link('LOAD MORE PRODUCT');
              $buffer = ob_get_contents();
              ob_end_clean();
              if(!empty($buffer)) echo $buffer;
              ?&gt;
              &lt;/div&gt;&lt;/div&gt;
          &lt;/div&gt;&lt;!--//load_more_cont--&gt;                   
          &lt;?php
          global $wp_query;
          //echo '**' . $wp_query-&gt;max_num_pages . '**';  
          $max_pages = $wp_query-&gt;max_num_pages;
          ?&gt;          
          &lt;div id="max_pages_id" style="display: none;"&gt;&lt;?php echo ceil($wp_query-&gt;found_posts / 9); //echo $max_pages-1; ?&gt;&lt;/div&gt;                    
  
      &lt;?php endif;
      //wp_reset_query();
      wp_reset_postdata();    
  
  ?&gt;              
      &lt;div class="clear"&gt;&lt;/div&gt;
  
  &lt;/div&gt;&lt;!--//container--&gt;
  </code></pre>
  
  <p></p>