How to display a description of a given category from a custom taxonomy

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:

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

This doesn’t appear to work with custom taxonomies.

The code:

<?php 
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?

Thanks,

Chris Planeta

Related posts

Leave a Reply

2 comments