WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using

echo get_the_term_list( $post->ID, 'trpropcity', '', ' ', '' );

to show a taxonomy link, I'd like to make this instance of it only have the first letter capitalized, Cleveland not CLEVELAND, I realize I could just change the taxonomy, but I actually want it all caps everywhere else on the site, so I figured it would be best to just change it once. I've been playing with ucwords and strtolower but haven't had any success yet.

share|improve this question
up vote 4 down vote accepted

Build the links yourself:

$terms = get_the_terms($post->ID, 'trpropcity');
  foreach($terms as $term)
    echo '<a href="'.get_term_link($term, 'trpropcity').'">'.ucwords(strtolower($term->name)).'</a>';
share|improve this answer
@Chuck use ucfirst instead of ucwords – Azizur Jun 28 '11 at 10:34
this worked except one small issue, if a post has no taxonomy assigned to it I get a warning, Invalid argument supplied for foreach(). My guess is I need to check if it has a taxonomy assigned to it and based on that proceed to echo. I'll have to keep working on that. – Chuck Jun 29 '11 at 0:12
no, the issue is that a post may have no terms; use the updated code – onetrickpony Jun 29 '11 at 9:05
Thanks again. – Chuck Jun 29 '11 at 22:24

As an alternative way - you can just use CSS styling for taxonomy links, might work too.

share|improve this answer
actually this might be a better idea than using PHP; the only downside is that search engines see the caps – onetrickpony Jun 27 '11 at 16:32
Thanks, but this seems to only work if starting with lowercase to begin with, cleveland to Cleveland but not CLEVELAND to Cleveland. – Chuck Jun 29 '11 at 0:16

More of a php question but i use ucfirst

share|improve this answer

Your Answer


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.