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.
定義位置
相關方法
tag_descriptioncategory_descriptionthe_author_descriptionthe_archive_descriptionwp_sidebar_description
引入
2.8.0
棄用
-

term_description: 這個函式顯示一個術語的描述。

檢索術語描述。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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;
}
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; }
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;
}

常見問題

FAQs
檢視更多 >