Last active
December 3, 2021 16:01
-
-
Save wpadmin/50fde22b9a68e5b24f42598326509589 to your computer and use it in GitHub Desktop.
WooCommerce 3.3 - Hide uncategorized category from the shop page on the frontend and Remove Categories from WooCommerce Product Category Widget
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 | |
/** | |
* WooCommerce 3.3 - Hide uncategorized category from the shop page on the frontend and Remove Categories from WooCommerce Product Category Widget | |
*/ | |
add_filter( 'woocommerce_product_subcategories_args', 'krs_remove_uncategorized_category' ); | |
add_filter( 'woocommerce_product_categories_widget_args', 'krs_remove_uncategorized_category' ); | |
add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'krs_remove_uncategorized_category' ); | |
add_filter( 'ywcca_wc_product_categories_widget_args', 'krs_remove_uncategorized_category' ); | |
function krs_remove_uncategorized_category( $args ) { | |
$args['exclude'] = get_option( 'default_product_cat' ); | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment