Get the label from ACF checkbox [closed]

You can try this $field = get_field_object(‘color’); $colors = get_field(‘color’); // array of selected color values foreach($colors as $color){ echo “selected color: “. $color. ” with label: ” . $field[‘choices’][ $color ]; } where the labels are fetched by get_field_object according to the link you provided. You could also use print_r() or var_dump() to check … Read more

Retrieve a specific field from taxonomy term through advanced custom fields [closed]

To retrieve a field from ACF for a term (instead of, for example, a post), you should use the taxonomy name, followed by an underscore, followed by the term ID instead of the post ID when calling the_field or get_field. Assuming you want to retrieve the field image_toc for the taxonomy mytax and term ID … Read more

Search with filters and title

First, you are setting $_GET[‘filterN’] but you are trying to use $_GET[‘condition_N’]. That is not ever going to work right. Secondly, pagename is an “exact match” value, not a search parameter, and it only works with the “Page” post type (at least so far as I can tell). You are using a CPT and, presumably, … Read more

Meta Query “IN” doesn’t work with ACF checkbox filter

Checkbox field is stored as serialized array, therefore you can not use the IN operator and array with the values you are looking for. To get posts with checked “melbourne”, change meta_query to: $meta_query = array( array( ‘key’ => $name, ‘value’ => ‘”melbourne”‘, ‘compare’ => ‘LIKE’, ) ); To get posts with melbourne or sydney: … Read more