Separate Custom Post Type Taxonomy by Comma

Share Now

Share on facebook
Share on pinterest
Share on twitter
Share on linkedin
Share on email
<?php
$postid = get_the_ID();
$ep_guests = get_the_terms($postid, 'guest');
?>
<?php
$guest_count = 1;
foreach ($ep_guests as $ep_guest):
?>
<?php
 echo $ep_guest->name;
echo ($guest_count < count($ep_guests)) ? ", " : "";
 $guest_count++; ?>
<?php endforeach; ?>

***Important Article: https://wordpress.stackexchange.com/questions/238359/separate-custom-post-type-taxonomy-by-comma

Nahid Mahamud

Nahid Mahamud

Web Developer | Graphic Designer | WordPress & Woo-commerce Expert