WordPress at Your Fingertips

term_description() WP 1.0

Retrieve term description.

No Hooks.

Return

String. Term description, if available.

Usage

term_description( $term, $deprecated );
$term(int)
Term ID.
Default: current term ID
$deprecated(null)
Deprecated. Not used.
Default: null

Changelog

Since 2.8.0 Introduced.
Since 4.9.2 The $taxonomy parameter was deprecated.

Code of term_description() WP 5.8.1

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;
}

Description (of post term)

Any taxonomy

Taxonomies (category, tag)

No comments
    Log In