Hi John,
I get this error when using your code:
Warning: Invalid argument supplied for foreach() in ... on line 83
I used the name of my field: book_type where you used checkbox_field.
Does it matter that it is a field used on a custom taxonomy? Not on a post.
Yes exactly as you describe. I want to use the Label (front end) in a variable instead of the value. I have tried all code I could find available on the internet, but I didn’t get it working, hope you can help me?
Thanks Hube2!
I needed to remove the continue; to get it to work.
Thank you, now I have this code, but some syntax error occurs on the line with the if statement:
<?php
$terms = get_terms( 'book_type', array(
'hide_empty' => 0
) );
foreach( $terms as $term ) {
if (in_array('Fiction', get_field('book_group', 'book_type_'.$term->term_id))
{
continue;
echo '<div>' . $term->name . '</div>';
}
}
?>
Hi Hube2
The Field Type is: Checkbox