Test Post with a Tag with Commas

JanR/ October 20, 2016/ WordPress Documentation/ 0 comments

As the title says, this is a WordPress post with a comma separated tag. Sometimes this comes in handy, for example when you want to display a taxonomy called “restaurant, bar” or a city and it’s country: “Groningen, the Netherlands”. This is all done using a simple WordPress filter, are you interested in the code?

WordPress taxonomy contains comma, i.e allow commas in tag names.

/**
 * WordPress filter for tags with commas
 * replace '--' with ', ' in the output - allows commas in tag names this way 
 * e.g. save tag as "Fox--Peter" but display like "Fox, Peter" 
 * or "cafe--restaurant" for a tag "cafe, restaurant"
 *
 * Follow me on Twitter: @HertogJanR, https://www.saotn.org
 * Donate: https://www.paypal.me/jreilink
 **/

You can find the function code and explanation in my Display commas in WordPress tags blog post on Sysadmins of the North:

Share this Post

Leave a Comment

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
*
*