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


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',
        'taxonomy' => 'resource-type',
        'field'    => 'slug',
        'terms'    => array('blog', 'ebook'),
Tristanisginger 1 month 0 Answers 5 views 0

Leave an answer