I need to retrieve a taxonomy field from Advanced Custom Field and display it in another plugin. I have tried using get_field but it’s not the field that I’m looking for, it gives another one. get_field worked for retrieving page_link field. I followed the instructions from the official site but no success.
This is my code

foreach($events[$today] as $event)
                {
                    $location = isset($event->data->locations[$event->data->meta['mec_location_id']])? $event->data->locations[$event->data->meta['mec_location_id']] : array();
                    $start_time = (isset($event->data->time) ? $event->data->time['start'] : '');

                    $end_time = (isset($event->data->time) ? $event->data->time['end'] : '');
                    $nome_spec = get_field('nome_dello_spettacolo', $event->ID);
                    foreach ($terms as $term) {
                            if ($term->parent) {
                                $teatro = $term->name;
                                $link = get_term_link($term->term_id);
                                break;
                            }
                        }



                    $events_str .= '<article class="mec-event-article">';

                    $events_str .= '<div class="mec-event-image">'.$event->data->thumbnails['thumblist'].'</div>';

                    if(trim($start_time)) $events_str .= '<div class="mec-event-time mec-color"><i class="mec-sl-clock-o"></i> '.$start_time.(trim($end_time) ? ' - '.$end_time : '').'</div>';

                    $event_color =  isset($event->data->meta['mec_color'])?'<span class="event-color" style="background: #'.$event->data->meta['mec_color'].'"></span>':'';

                    $events_str .= '<h4 class="mec-event-title"><a class="mec-color-hover" href="'.$nome_spec.'">'.$event->data->title.'</a>'.$event_color.'</h4>';

                    $events_str .= '<h4 class="mec-event-teater"><a class="mec-color-hover" href="'.$teatro.'">'.$event->data->title.'</a>'.$event_color.'</h4>';

                    $events_str .= '<div class="mec-event-detail">'.(isset($location['name']) ? $location['name'] : '').'</div>';

                    $events_str .= '</article>';


                }

Thanks!

Read more here: Obtain taxonomy field from Advanced Custom Field


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: