# Hide the "Uncategorized" Product Category

> Keeps the default Uncategorized product category out of category lists on the shop and in the product categories block and widget.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, categories, shop
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-hide-uncategorized/

## Code

```php
add_filter( 'get_terms_args', function ( $args, $taxonomies ) {
    if ( is_admin() || ! in_array( 'product_cat', (array) $taxonomies, true ) ) {
        return $args;
    }

    $default = (int) get_option( 'default_product_cat' );

    if ( $default ) {
        $args['exclude'] = array_merge( wp_parse_id_list( $args['exclude'] ?? array() ), array( $default ) );
    }

    return $args;
}, 10, 2 );
```

## Notes

Products in the category are still visible in the shop; only the category itself is hidden.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Hide the "Uncategorized" Product Category" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
