term_description( int $term, null $deprecated = null ): string

Retrieves term description.

Parameters

$termintoptional
Term ID. Defaults to the current term ID.
$deprecatednulloptional
Deprecated. Not used.

Default:null

Return

string Term description, if available.

More Information

First available with WordPress Version 2.8, this template tag returns the description of a given term. A term ID and taxonomy are as parameters. If no term ID is passed, the description of current queried term (e.g. post category or tag) will be returned.

Output is wrapped in <p> tags.

Source

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

Changelog

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

User Contributed Notes

  1. Skip to note 5 content

    If you want to filter the description, don’t use this function, use get_the_archive_description() instead. This one does apply_filters before returning the description, and uses term_description() internally to retrieve the description when is for a term.

You must log in before being able to contribute a note or feedback.