Support

Account

Home Forums Front-end Issues ACF: How to get the label of a taxonomy Checkbox Field? Reply To: ACF: How to get the label of a taxonomy Checkbox Field?

  • could you try if this works:

    $book_type ='';
    	$book_type_field = get_field_object('book_type');
    	$book_type_values = get_field('book_type');
    	$count = count($book_type_values);
    	foreach ($book_type_values as $key => $value) {
    		$book_type .= $book_type_field['choices'][ $value ];
    		if (($count - 1  - $key) >= 1){$book_type .= ', ';}
    	}
    echo $book_type; //do this whenever you wish (this variable should contain all chosen labels, separated by a comma)
    

    or do you get also a error with this code