Support

Account

Home Forums ACF PRO Separate Custom Taxonomy By Comma Reply To: Separate Custom Taxonomy By Comma

  • https://codex.wordpress.org/Debugging_in_WordPress, sometimes little bugs, like missing semicolons, happen when people post code on a forum. How do you debug any code you create yourself?

    
    <?php 
      $terms = get_field('location_type');
      if( $terms ):
        $total = count($terms);
        $count = 1;
        foreach( $terms as $term ):
          ?>
            <a href="<?php 
              echo get_term_link( $term ); ?>"><?php 
              echo $term->name; ?></a>
          <?php 
          if ($count < $total) {
            echo ', ';
          }
          $count++;
        endforeach;
      endif; 
    ?>