## How do I filter get_terms() by terms in another taxonomy?

Question

I have a custom post type ‘resources’ that has two taxonomies ‘topic’ and ‘type’. I want to get the number of each ‘topic’ with the ‘type’ of either ‘ebook’ or ‘blog’.

This pseudo code is a reflection of what i want to be able to do

\$resource_topics = get_terms( array(
'taxonomy' => 'resource-topic',
'hide_empty' => false,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'resource-type',
'field'    => 'slug',
'terms'    => array('blog', 'ebook'),
),
),
));

0
2 years 2020-12-16T10:10:51-05:00 0 Answers 5 views 0