term_description( int $term, string $taxonomy = 'post_tag' )

Retrieve term description.


Description Description


Parameters Parameters

$term

(int) (Optional) Term ID. Will use global term ID by default.

$taxonomy

(string) (Optional) taxonomy name. Defaults to 'post_tag'.

Default value: 'post_tag'


Top ↑

Return Return

(string) Term description, available.


Top ↑

Source Source

File: wp-includes/category-template.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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