Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kloon/59f50820dbd7b71f785af59c7b65f1eb to your computer and use it in GitHub Desktop.
Save kloon/59f50820dbd7b71f785af59c7b65f1eb to your computer and use it in GitHub Desktop.
WooCommerce 3.3 Hide uncategorized category from shop
<?php
add_filter( 'woocommerce_product_subcategories_args', 'remove_uncategorized_category' );
/**
* Remove uncategorized category from shop page.
*
* @param array $args Current arguments.
* @return array
**/
function remove_uncategorized_category( $args ) {
$uncategorized = get_option( 'default_product_cat' );
$args['exclude'] = $uncategorized;
return $args;
}
@boutzamat
Copy link

This snippet didnt work, and neither did the one JayHoltslander suggested.

@wickywills
Copy link

Doesn't work - does nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment