Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
@ctmurphyri

This comment has been minimized.

Copy link

@ctmurphyri ctmurphyri commented Feb 24, 2018

Thanks, this worked perfectly.
Small note, the <?php at the top is not needed on the functions page.
Thanks Kloon for this great code!

@CBC8

This comment has been minimized.

Copy link

@CBC8 CBC8 commented Mar 3, 2018

Sorry, where do I put this code ? Thanks !

@JayHoltslander

This comment has been minimized.

Copy link

@JayHoltslander JayHoltslander commented Mar 7, 2018

None of the suggestions here worked for me but this did.

@boutzamat

This comment has been minimized.

Copy link

@boutzamat boutzamat commented Jun 6, 2018

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

@wickywills

This comment has been minimized.

Copy link

@wickywills wickywills commented Mar 6, 2019

Doesn't work - does nothing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.