A bit confusing I know but anyway let me try to define the problem… )) A marketplace site has a custom post type ‘company’ for listing suppliers. They ‘company’ post type has attached custom taxonomies called ‘product-categories’ and ‘product-brands’. I can list the terms of these taxonomies so that users can find necessary suppliers based on product categories or brands or both.
I also would like to link the two taxonomies together, i.e. each ‘brand’ has ‘product categories’ attached so that each brand term indicates which product category it belongs to. I did it by adding a custom field to the ‘brand’ taxonomy and attaching the ‘product category’ to that field. Now I can display the product categories for each brand on its term page.
However, the other way around turns out to be more difficult. When I try to indicate what brands are associated with a given product category, I cannot find a solution. I need to list ‘brand’ taxonomy terms that are attached to a given ‘product category’ taxonomy term.
Or let me reword this in ACF terms. ) How I can get all taxonomy terms that have a specific value in one of their custom fields? I can’t use wp_query as I’m not looking to find posts but taxonomy terms. Tried wp_get_object_terms, for some reason it did not work.