Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



term_description ›

Seit2.8.0
Veraltetn/v
term_description ( $term = 0, $taxonomy = 'post_tag' )
Parameter: (2)
  • (int) $term Optional. Term ID. Will use global term ID by default.
    Erforderlich: Nein
    Standard:
  • (string) $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
    Erforderlich: Nein
    Standard: 'post_tag'
Gibt zurück:
  • (string) Term description, available.
Definiert in:
Codex:

Retrieve term description.



Quellcode

function term_description( $term = 0, $taxonomy = 'post_tag' ) {
	if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
		$term = get_queried_object();
		if ( $term ) {
			$taxonomy = $term->taxonomy;
			$term = $term->term_id;
		}
	}
	$description = get_term_field( 'description', $term, $taxonomy );
	return is_wp_error( $description ) ? '' : $description;
}