Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to get_the_tag_list but want to remove whitespace within individual tags.

Thus, firefox, internet explorer, opera becomes firefox, internetexplorer, opera

All the filters I found removed whitespace from the HTML, not the content itself.

share|improve this question

1 Answer 1

up vote 1 down vote accepted
$tags = get_the_tags();
$tag_links = array();

foreach((array)$tags as $tag)
  $tag_links[] = '<a href="'.get_tag_link($tag->term_id).'" rel="tag">'.str_replace(' ', '', $tag->name)).'</a>';

echo implode(', ', $tag_links);
share|improve this answer
    
Wordpress gives me an error because of the extra ) after $tag->name but once I corrected that, it worked fine. Thanks! –  Daze Jul 1 '11 at 21:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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