title: Exclude specific product categories on Woocommerce single product pages
body: <p>I'm trying to exclude some categories from being displayed on the WooCommerce product page. </p>
  
  <p><em>Example</em>: if in a single product page I have "Categories: Cat1, Cat"2",  I want that only Cat1 will be displayed.</p>
  
  <p>I tried editing the <em>meta.php</em> in the single-product template.
  I created a new function:</p>
  
  <pre><code>$categories = $product-&gt;get_category_ids();
  $categoriesToRemove = array(53,76,77,78); // my ids to exclude
  foreach ( $categoriesToRemove as $categoryKey =&gt; $category) {
      if (($key = array_search($category, $categories)) !== false) {
          unset($categories[$key]);
      }
  }
  $categoriesNeeded = $categories;
  </code></pre>
  
  <p>Then I have the echo from WooCommerce:</p>
  
  <pre><code>echo wc_get_product_category_list( $product-&gt;get_id(), ', ', '&lt;span class="posted_in"&gt;' . _n( 'Category:', 'Categories:', count($categories), 'woocommerce' ) . ' ', '&lt;/span&gt;' );
  </code></pre>
  
  <p>But it still shows the same categories. The strange thing is that when I do a <code>var_dump($categories)</code> it shows the correct thing.</p>