term_description

The timeline below displays how wordpress function term_description has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Retrieves term description.
 *
 * @since 2.8.0
 * @since 4.9.2 The `$taxonomy` parameter was deprecated.
 *
 * @param int  $term       Optional. Term ID. Defaults to the current term ID.
 * @param null $deprecated Deprecated. Not used.
 * @return string Term description, if available.
 */
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;
}

WordPress Version: .10

/**
 * Retrieve term description.
 *
 * @since 2.8.0
 * @since 4.9.2 The `$taxonomy` parameter was deprecated.
 *
 * @param int  $term       Optional. Term ID. Will use global term ID by default.
 * @param null $deprecated Deprecated argument.
 * @return string Term description, available.
 */
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;
}

WordPress Version: 3.9

/**
 * Retrieve term description.
 *
 * @since 2.8.0
 *
 * @param int $term Optional. Term ID. Will use global term ID by default.
 * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
 * @return string Term description, available.
 */
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;
}

WordPress Version: 3.7

/**
 * Retrieve term description.
 *
 * @since 2.8
 *
 * @param int $term Optional. Term ID. Will use global term ID by default.
 * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
 * @return string Term description, available.
 */
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;
}