Languages: English • 日本語 (Add your language)
First available with WordPress Version 2.8, this template tag returns the description of a given term. A term ID and taxonomy are as parameters. If no term ID is passed, the description of current queried term (e.g. post category or tag) will be returned.
<?php echo term_description( $term_id, $taxonomy ) ?>
The default usage returns the description of the current queried term.
<?php $description = term_description(); ?>
Displays a description of the post tag ID 28.
<?php echo 'Term Description: ' . term_description('28','post_tag'); ?>
Displays a description for each item returned by wp_get_nav_menu_items (if they are taxonomy items).
<?php $myterms = wp_get_nav_menu_items('my-terms'); foreach ($myterms as $item) { // check if it's a taxonomy if ($item->type == 'taxonomy') { // display the description echo term_description($item->object_id, $item->object); } } ?>
term_description() is located in wp-includes/category-template.php
.