检索术语描述。
原型
term_description( int $term, null $deprecated = null )
参数
$term
(int)
(Optional)
术语ID。默认情况下将使用全局术语ID。
$deprecated
(null)
(Optional)
不赞成的论点。
返回值
(string)
术语描述,可用。
源文件
路径:wp-includes/category-template.php
<?php
...
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;
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/term_description/