I’m having a custom taxonomy for addresses. And I’ve created a true/false button through acf plugin to tell an address that it’s the standard address.

How can I get only the one term that has “standard address” set to “true”?

Here is my approach:

    $taxonomy = 'addresses';
    $args = array(
       'numberposts'    => 1,
       'meta_query' => array(
          array(
            'key'     => 'standardaddress',
            'value'   => true,
            'compare' => '=',
            ),
        ),
        'suppress_filters' => false,
    );
    $terms = get_terms( $taxonomy, $args );

But this way I only get the first term entered, which doesn’t have “standardaddress” set to “TRUE”.

0

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *