How to hide the current category from WooCommerce filter by category lists

When users browse a WooCommerce category page, showing the current category again inside a filter list creates redundancy and confusion. It can also hurt conversions by adding unnecessary friction to product discovery.

In this guide, we’ll show how to hide the active category from “Filter by Category” lists while preserving dynamic filtering behavior, plugin compatibility, and performance.

Issue Background

On category archive pages, the filter UI displayed the current category as a selectable option. For example, when viewing a specific category page, that same category still appeared in the filter list.

This resulted in a redundant UX and inconsistent filtering behavior across pages.

Diagnosis

Default WooCommerce taxonomy queries

WooCommerce uses standard WordPress taxonomy queries for product_cat. By default, these queries include the currently queried term.

Filter widgets inherit query behavior

Most filter plugins and widgets (including custom implementations) rely on get_terms() or similar queries, which means they will include the current category unless explicitly excluded.

Regression after updates

The behavior had previously been customized, but changes or updates removed the exclusion logic, causing the issue to reappear.

Resolution Steps

1. Get the current category

$current_category = get_queried_object();

if ($current_category && isset($current_category->term_id)) {
    $current_cat_id = (int) $current_category->term_id;
}

2. Exclude the current category from the terms query

$args = [
    'taxonomy'   => 'product_cat',
    'hide_empty' => true,
    'exclude'    => [$current_cat_id],
];

$categories = get_terms($args);

3. Apply conditionally on product category pages

if (is_product_category()) {
    // Run modified query here
}

4. Ensure only categories with products are shown

'hide_empty' => true

5. Support advanced rules per category

For stores with different behaviors per section, add conditional logic:

$broad_sections = ['afw', 'overstock', 'new-arrivals'];

if (!is_product_category($broad_sections)) {
    // Limit categories to a predefined set
}

Advanced: using filters to modify queries globally

If your filters are powered by a plugin or multiple templates, you can hook into WordPress filters to exclude the current category globally.

Using get_terms_args

add_filter('get_terms_args', function($args, $taxonomies) {
    if (is_product_category() && in_array('product_cat', (array) $taxonomies, true)) {
        $current = get_queried_object();
        if ($current && isset($current->term_id)) {
            $args['exclude'] = isset($args['exclude'])
                ? array_merge((array) $args['exclude'], [$current->term_id])
                : [$current->term_id];
        }
    }
    return $args;
}, 10, 2);

Using terms_clauses (lower-level control)

add_filter('terms_clauses', function($clauses, $taxonomies, $args) {
    if (is_product_category() && in_array('product_cat', (array) $taxonomies, true)) {
        $current = get_queried_object();
        if ($current && isset($current->term_id)) {
            global $wpdb;
            $clauses['where'] .= $wpdb->prepare(' AND t.term_id != %d', $current->term_id);
        }
    }
    return $clauses;
}, 10, 3);

Plugin-specific notes

  • FacetWP: Use facet query filters or hook into facetwp_facet_args.
  • WOOF (WooCommerce Products Filter): Adjust tax query arguments or exclude terms via plugin settings.
  • Elementor / theme widgets: May require overriding widget queries or using global filters above.

Quick troubleshooting checklist

  • Confirm you are on a product_cat archive
  • Verify get_queried_object() returns a term
  • Ensure no plugin overrides your query
  • Check caching (object/page cache) after changes
  • Test across multiple category pages

Final Outcome

The current category is no longer shown in its own filter list. Filters now display only relevant categories with products, improving usability, reducing redundancy, and creating a cleaner browsing experience.

If you need help customizing WooCommerce filters, taxonomy queries, or advanced product navigation, our team can help.

Contact Freshy