Support

Account

Home Forums ACF PRO How to display only these terms with specific field value

Solved

How to display only these terms with specific field value

  • Hello friends,

    I am using ACF Pro 5.5.12v. I have a field group that is equal to my TaxonomyName(“destination”). In this group I made a custom field with type “checkbox” and name “picmenu”. I am trying to display all term names which have selected some specific checkbox value.
    var_dump returns “array(0) { }”.
    By the way, I’m not sure is this is the way to get terms with meta value.

    <?php
    $terms = get_terms( 
    	array(
    		'taxonomy' => 'destination',
    		'hide_empty' => false,
    		'meta_query' => array(
    		         array(
    		            'key' => 'picmenu',
    			    'value' => 'test',
    			    'compare' => '=',
    		         )
    	        ),
    									
            )
    	);
     ?>
    <?php var_dump($terms); ?>
  • I found my mistake here
    'compare' => '=',

    Need to be like
    'compare' => 'LIKE',

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘How to display only these terms with specific field value’ is closed to new replies.