Remove a comma from last item in categories list

I was developing a wordpress theme and came across this issue that my custom post type categories show comma at last category item. My code was like this:

So, by using rtrim and modifying code a bit; i was able to fix this problem. Below is my final code.

Please adjust your code accordingly to solve this issue.

Happy Coding!

About Zahid Iqbal

Zahid Iqbal is a founder and ceo of MZ Creative Studio. He is a web developer and designer with over 3 years of experience. His mission is to provide best web services and useful tools to everyone round the globe.

Leave a Reply

Your email address will not be published. Required fields are marked *

Do you have a website project you’d like to discuss?

Get in touch