Get term slug by term id and then explode it
I guess the problem is here. $slug = $term->slug; $explodedSlug = explode(‘-‘, $_slug); you are passing an undefined array $_slug to explode function. the correct array is $slug. so your complete code should be something like below. function revised_featured_courses_query() { $meta_query = WC()->query->get_meta_query(); $tax_query = WC()->query->get_tax_query(); $tax_query[] = array( ‘taxonomy’ => ‘product_visibility’, ‘field’ => ‘name’, … Read more