term_description

函数


term_description ( $term = 0, $deprecated = null )
参数
  • (int)
    $term
    Optional. Term ID. Defaults to the current term ID.
    Required:
  • (null)
    $deprecated
    Deprecated. Not used.
    Required:
    Default: null
返回值
  • (string) Term description, if available.
定义位置
  • wp-includes/category-template.php
    , line 1264
引入
2.8.0
弃用

Retrieves term description.

function term_description( $term = 0, $deprecated = null ) {
	if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
		$term = get_queried_object();
		if ( $term ) {
			$term = $term->term_id;
		}
	}

	$description = get_term_field( 'description', $term );

	return is_wp_error( $description ) ? '' : $description;
}