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 have a taxonomy called tcp_product_category. In the admin panel I have created a few terms within this taxonomy. On the homepage I want to display the description of one of those terms with the slug all-products.

For all normal categories I use this code:

<?php echo category_description( get_term_by('slug', 'guide', 'category')->term_id  ); ?>

This doesn't appear to work with custom taxonomies.

The code:

echo category_description( 
    get_term_by('slug', 'all-products', 'tcp_product_category')->term_id

All the values I inserted are correct, but the get_term_by() simply doesn't give any results. Any ideas how to fix it?


Chris Planeta

share|improve this question

Ok. I've found a solution. Thanks to this great article on Smashing Magazine

The code to retrieve category description from any taxonomy term would be :

<?php echo (get_term_by('slug', 'your-term-name', 'your-taxonomy-name')->description); ?>

As simple as that

share|improve this answer

It's more readable and just generally more WordPress-y to use the built-in term_description() function!

<?php echo term_description( {term_id}, '{taxonomy}' ); ?>
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.