Support

Account

Home Forums General Issues How to use the taxonomy/result filter? Reply To: How to use the taxonomy/result filter?

  • 
    function your_function_name($title, $term, $field, $post_id) {
      $ancestors = get_ancestors($term, $term->taxonomy, 'taxonomy');
      if (!empty($ancestors)) {
        $parts = array();
        array_reverse($ancestors)
        foreach ($ancestors as $ancestor) {
          $ancestor_term = get_term($ancestor, $term->taxonomy);
          $parts[] = $ancestor_term->name;
        }
        $parts[] = $term->name;
        $title = implode(' => ', $parts);
      }
      return $title;
    }