wp query display product categories for custom taxonomy
-
hi
so i am just trying to figure out a taxonomy query & what i want is when the user lands on the custom taxonomy archive page, i want to display to them all the product categories of the posts (products) for that page. so i want to find all categories & all subcategories for the posts. Custom taxonomy is workplace as below:so maybe its something like this:
$term = get_queried_object(); $args = array( 'post_type' => 'post', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'product_cat', 'field' => 'slug' , ), array( 'taxonomy' => 'workplace', 'field' => 'slug', 'terms' => $term, 'operator' => 'IN', ), ), ); $query = new WP_Query( $args );
But i just can’t figure out how to ONLY display their categories rather than the actual posts. I had it working perfect through using the woo product loop until i realised it was affecting pagination.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wp query display product categories for custom taxonomy’ is closed to new replies.