I created a taxonomy vocabulary with several terms and it is assigned to a content type. So a node can have multiple terms from that vocabulary. After assigning it I have created a view to format the content type nodes into a json data.

Now in the JSON data the taxonomy field is showing multiple values. I want to separate those individual items by comma. Please help me out how to do it. I've tried adding this expression to the tpl file.

]+>/i', ', ', $output); ?>


Without seeing your view, it is difficult to solve. But if you edit the taxonomy field in your view, make sure that in the MULTIPLE FIELD SETTINGS section the checkbox "Display all values in the same row" is checked. That should display the taxonomy terms as term 1, term 2, term n.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.