Went about it a different way, works OK.
Just in case anyone else is looking for similar functionality;
//* dropdown
add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'woo_product_cat_widget_args' );
//* list
add_filter( 'woocommerce_product_categories_widget_args', 'woo_product_cat_widget_args' );
function woo_product_cat_widget_args( $cat_args ) {
if ( is_product_category( 'experiences' ) || term_is_ancestor_of( 2921, get_queried_object_id(), 'product_cat' ) ) {
$cat_args['exclude'] = array(2548, 2245, 2775, 2913, 2846);
return $cat_args;
}
else {
$cat_args['exclude'] = array('2921');
return $cat_args;
}
}
Related Posts:
- Using wp_category_checklist in a widget
- How to remove the parentheses from the category widget
- Filter categories using tags
- Woocommerce Product Category Widget – hide categories that have no products in stock [closed]
- Make parent categories not selectable
- How to create a widgetized sidebar for every category dynamically?
- Customizing Default Categories Widget
- Display all posts with same title
- I want to create a posts widget and be able to select categories
- Add custom category name as data-filter to switch between these categories
- How to have Multiple Archives Widgets, one archive widget per category (in a different page)?
- Categories lose hierarchy order once assigned to post
- Can paginate_links() be customized for a specific category or tag?
- Filtering by Category doesnt paginate correctly on the backend
- Dropdown category filter
- Add Icons to the Product Category Sidebar Widget WooCommerce
- Make parent category not selectable when it has child categories
- Replace category titles
- Hide posts of a certain category unless logged in
- What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?
- How to Filter categories in the permalink structure
- How to display posts under a specific subcategory of a given category
- Taxonomy filter all children
- Filter Home Page Posts in Buddypress [closed]
- Categorising posts/pages into years published
- How to display widgets inside a page content without a plugin?
- Inserting Category programmatically
- Automatically set default password to all posts in a specific category
- Need help using a filter on the default Categories widget
- get_the_categories filter returns an empty array
- category filter doesn’t work in WPML
- How do you categorize pages?
- Query posts from category based on a filter most favorited
- Filter Categories in meta box for CPTs
- WordPress category widget only show categories with children
- Show only first category name in RSS?
- How to organize custom categories for filtering and selecting
- Customize WordPress widget – Product Category
- Filter $cpt categories to omit certain category
- How to set a filter by category within a customised page
- Post Count for Categories, however not to calculate a total
- Refine/Filter the Search Results by Category
- Admin comments and user restrictions
- How do I make the category sidebar widget (stock) display the total # of posts including those in subcategories?
- WordPress Post # of # filtered by category slug
- Pagination for ajax category filter
- ajax for filtering posts by category in wordpress loops
- How to hide category name
- Categories widget show empty?
- Is it possible to remove from default category widget?
- How to make the ‘delete’ button inactive on some categories?
- How to not display subcategories in Recent Posts widget area?
- Change post title if post has specific category
- Filter By Category Dropdown List With Custom Taxonomies
- How to Sync Menu, Widgets and other masters from Main Website to its Sub Site
- Tags Instead of Category
- How to hide widget from certain category
- How can I filter posts by tag on the fly
- Change Default Content when Creating a Post based on Previous Category Choice
- Maintaining a separate posts page for certain categories and don’t show those on home page
- Last x Posted Categories?
- WordPress category filters as subcategories
- Exclude posts without category from loop
- How to filter post from categories only if the posts appears in one of them, not the other?
- exclude certain categories form archive widget
- How to fix select filter on category
- wp_dropdown_categories() works correctly but the list is not filtered in admin for custom post type. What is the problem?
- Conditional widget for theme template file
- Add $args to wp_list_categories
- How to hide a category or tag everywhere EXCEPT for use with get_posts
- How to create category filter on a blog like on the site below?
- How to filter tags by category?
- Custom Taxonomy Isotope Grid – Filter Buttons Not Working
- How to exclude a category returned by get_categories from function.php?
- Exclude a category from block editor’s category widget
- Can’t display posts by filtering categories using isotope.js
- How can I display the category name in the single post when using WP Blog and Widget?
- Correct Hook/Filter to amend category choices on post edit page
- Restrict retrieved terms by category?
- Hiding by default posts in given category except for some cases
- How to Change Sort Order of default WordPress Catgory Widgets?
- Remove “Category:”
- How to add an “All” category to the tag cloud?
- Custom file with special code of category widget
- ACF Gallery with Media Categories – how do display categories and sort
- in_category(‘category-sluga’) returns true for Archive page of Category ‘category-slugb’
- Custom filters inside a specific category?
- filter single_cat_title avoiding the breadcrumbs
- Right way for setting categories
- How to use in_category?
- Custom built theme won’t filter categories
- Problem with single posts not showing correct category sidebar
- How To Disable Category Hierarchy In Categories Widget?
- category filter doesn’t work
- single category widget with conditional terms
- Customize category query in widget
- How to create a photo gallery that can be filtered by the image categories
- Remove “?category=” in the URL wordpress ajax filter work for category
- Replace category titles inside RSS feed
- Exclude category in widget through child theme