Support

Account

Home Forums ACF PRO Add Custom Tax To Relationship Field? Reply To: Add Custom Tax To Relationship Field?

  • Try this

    
    function my_relationship_result($title, $post, $field, $post_id) {
      $args = array(
        'fields' => 'names'
      );
      $terms = wp_get_post_terms($post->ID, 'area', $args);
      if ($terms) {
        $title .= ' ['.implode(', ', $terms).']';
      }
      return $title;
    }
    add_filter('acf/fields/relationship/result', 'my_relationship_result', 10, 4);