term_description

Retrieve term description.

Description

(string) term_description( (int) $term = 0, (string) $taxonomy = 'post_tag' ); 

Returns (string)

Term description, available.

Parameters (2)

0. $term — Optional. (int)
Term ID. Will use global term ID by default.
1. $taxonomy — Optional. (string) => 'post_tag'
Taxonomy name. Defaults to post_tag..

Usage

  1. if ( !function_exists( 'term_description' ) ) { 
  2. require_once ABSPATH . WPINC . '/category-template.php'; 
  3.  
  4. // Optional. Term ID. Will use global term ID by default. 
  5. $term = -1; 
  6.  
  7. // Optional taxonomy name. Defaults to 'post_tag'. 
  8. $taxonomy = 'post_tag'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = term_description($term, $taxonomy); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/category-template.php  
  1. function term_description( $term = 0, $taxonomy = 'post_tag' ) { 
  2. if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) { 
  3. $term = get_queried_object(); 
  4. if ( $term ) { 
  5. $taxonomy = $term->taxonomy; 
  6. $term = $term->term_id; 
  7. $description = get_term_field( 'description', $term, $taxonomy ); 
  8. return is_wp_error( $description ) ? '' : $description;