function hide_empty_category( $arg ){ $arg[ 'hide_empty' ] = 1; return $arg; } add_filter( 'woocommerce_product_categories_widget_args', 'hide_empty_category' )