How to use germ_terms() with meta_query for ACF Taxonomy field?

Question

I have a custom taxonomy, Events (“event”).

Through ACF, this also has a Taxonomy field, “Topic”, linking it to a secondary taxonomy, Topic (“topic”).

I want to get_terms() for all Events terms which bear the specific “Topic” term “Media”, which happens to have term ID 422.

I know get_terms() can take meta_query, but I don’t understand how to properly get what I need.

Both of these return no results…

'meta_query' => array(
        array(
          'key'     => 'Topic',
          'value'   => '422',
        )
      )

'meta_query' => array(
        array(
          'key'     => 'Topic',
          'value'   => 422,
        )
      )

FYI, my “Topic” Taxonomy ACF field “Return Value” is set to “Term ID”, which is why I attempted passing ‘422’.

As it happens, to test, when I…

– do a get_terms() without meta_query

– then get_term_meta() to get the “Topic” of the terms

– then print out the result…

… I see a formulation like Array ( [0] => Array ( [0] => 422 ) )

That’s where the 422 is buried.

0
Robert Andrews 2 years 2020-12-28T17:11:03-05:00 0 Answers 5 views 0

Leave an answer

Browse
Browse