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

what I need is this: add a term from a custom post to the post's title. Like this: Custom Post title - term

Right now I have:

$terms_of_post = strip_tags (get_the_term_list( $post->ID, 'my-custom-term', '','', '', '' ));

elseif ( is_single() ) { single_post_title(); {echo ' ('; echo $terms_of_post;  echo ')';} ; }       

I don't know why it doesn't work, but it seems it should.

I have found Copy a Taxonomy Term into the Post Title for a certain Custom Post Type, which could be 90% of the answer, but instead of replacing the post title with the taxonomy title, I need to add it to the title.

Thanks a lot!

share|improve this question
up vote 1 down vote accepted

You can try this (based on your unfinished PHP code)

if ( is_single() ) { 
    $terms_of_post = get_the_term_list( get_the_ID() , 'my-custom-term', '',', ', '', '' );
    $terms_of_post = strip_tags ( $terms_of_post );
    if( $terms_of_post ){
        echo ' (' . $terms_of_post . ')';

to get this format:

Title (term1, term2, term3)
share|improve this answer
Thanks a lot! My connection was down and I could not test this. But I can confirm it works. – JenRe Jun 11 '13 at 17:28
ok, great to hear that, cheers. – birgire Jun 11 '13 at 17:32

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.