Title: hide certain subcategory
Last modified: August 24, 2021

---

# hide certain subcategory

 *  Resolved [mrloco](https://wordpress.org/support/users/mrloco/)
 * (@mrloco)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/hide-certain-subcategory/)
 * Hi!
 * I have tried to hide a certain subcategory from my shop(shop page and other pages,
   there is a category widget).
    I found that the code below works for all pages
   except the shop page. If i change `is_product_category()` for the `is_shop()`,
   so it works for the shop page, but not for the other pages.
 * How can i do that it works for ALL pages (shop and all others)?
 *     ```
       add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
   
       function get_subcategory_terms( $terms, $taxonomies, $args ) {
   
         $new_terms = array();
   
         // if a product category and on the shop page
         if ( in_array( 'product_cat', $taxonomies ) && ! is_admin() && is_product_category() ) {
   
           foreach ( $terms as $key => $term ) {
   
             if ( ! in_array( $term->slug, array( 'seinakellad','nastennye-chasy','wall-clock' ) ) ) {
               $new_terms[] = $term;
             }
   
           }
   
           $terms = $new_terms;
         }
   
         return $terms;
       }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Support [Sol J. a11n](https://wordpress.org/support/users/solstudioim/)
 * (@solstudioim)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/hide-certain-subcategory/#post-14819554)
 * This is a fairly complex development topic.
 * I recommend [the WooCommerce Developer Resources Portal](https://developer.woocommerce.com/)
   for resources on developing for WooCommerce.
 * You can also visit the [WooCommerce Facebook group](https://www.facebook.com/groups/advanced.woocommerce/)
   or the `#developers` channel of the [WooCommerce Community Slack](https://woocommerce.com/community-slack/).
   We’re lucky to have a great community of open-source developers for WooCommerce,
   and many of our developers hang out there, as well.

Viewing 1 replies (of 1 total)

The topic ‘hide certain subcategory’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Sol J. a11n](https://wordpress.org/support/users/solstudioim/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/hide-certain-subcategory/#post-14819554)
 * Status: resolved