'Get all terms from posts that have a certain post meta value

I am trying to get all terms from a custom post type (artist) that have a meta_key(performance_date_1) and a meta_value(20220430) that I created with ACF.

This is what I have tried so far.

$events = get_terms( 'artist_event', array(
    'post_type' => 'artist',
    'taxonomy' => 'artist_event',
    'hide_empty' => false,
    'suppress_filters' => false,
    'meta_query' => array(
        // 'relation' => 'OR',
        array(
            'key' => 'performance_date_1',
            'compare' => '=',
            'value' => '20220430',
        )
    ),
) );

When using get_terms is the meta_query looking in taxonomy fields or post fields? I need the meta query to look for post fields to fix this issue I believe.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source