WordPress at a glance

term_description() WP 1.0

Retrieve term description.

Notes:

  • Since 4.9.2 The $taxonomy parameter was deprecated.
Works based on: get_term_field()

No Hooks.

Return

String. Term description, available.

Usage

term_description( $term, $deprecated );
$term(int)
Term ID. Will use global term ID by default.
Default: 0
$deprecated(null)
Deprecated argument.
Default: null

Code of term_description: wp-includes/category-template.php VER 4.9.8

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

Related Functions

From tag: Description (of post term)

More from category: Any taxonomy

More from Template Tags: Taxonomies (category, tag)

No comments
    Hello, !     Log In . Register