wp query – Get list of terms that have posts in another term

Question

I have a product attribute called “color” and when I am on the archive page (e.g. color=blue) I want to display a list of all the parent product categories that contain products with that attribute, color=blue.

I tried using get_queried_object_id() to get the archive term (blue), in conjunction with get_terms(), however I couldn’t figure it out. I’d like to reiterate that I want to retrieve the list of terms and not the posts.

If anyone can lead me in the right direction, I’d appreciate it!

This question seems similar to what I want, however it uses wpdb, and want to use a regular query

0
Edegist 5 months 2021-05-23T22:51:02-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse