Created
February 9, 2018 05:30
-
-
Save kloon/59f50820dbd7b71f785af59c7b65f1eb to your computer and use it in GitHub Desktop.
WooCommerce 3.3 Hide uncategorized category from shop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sorry, where do I put this code ? Thanks !
None of the suggestions here worked for me but this did.
This snippet didnt work, and neither did the one JayHoltslander suggested.
Doesn't work - does nothing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, this worked perfectly.
Small note, the <?php at the top is not needed on the functions page.
Thanks Kloon for this great code!